528 lines
16 KiB
C#
528 lines
16 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using GCGame;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Module.Log;
|
|||
|
using Games.LogicObj;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.UserCommonData;
|
|||
|
using Games.Events;
|
|||
|
using Games.Mission;
|
|||
|
using Games.Item;
|
|||
|
|
|||
|
public class FunctionExLogic : UIControllerBase<FunctionExLogic>
|
|||
|
{
|
|||
|
public GameObject _DetailPanle;
|
|||
|
public GameObject _OpenBtn;
|
|||
|
public GameObject _CloseBtn;
|
|||
|
public Animator _OpenBtnAnimator;
|
|||
|
public BtnList _BtnList;
|
|||
|
public Animator _GridPanel;
|
|||
|
public bool _IsBtnShow = false;
|
|||
|
public Transform _backTransform; //背包位置
|
|||
|
public void OnEnable()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
UpdateRedTips();
|
|||
|
}
|
|||
|
|
|||
|
//private void Update()
|
|||
|
//{
|
|||
|
// if(Input.GetKeyDown(KeyCode.V))
|
|||
|
// {
|
|||
|
// LogModule.ErrorLog("Test !!!");
|
|||
|
// AdvanceBase.ReqAllAdvanceInfo();
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
public void OnDisable()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
}
|
|||
|
|
|||
|
public void Start()
|
|||
|
{
|
|||
|
ShowDetail(false);
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnShow()
|
|||
|
{
|
|||
|
if (_IsBtnShow)
|
|||
|
{
|
|||
|
ShowDetail(false);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ShowDetail(true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ShowDetail(bool show)
|
|||
|
{
|
|||
|
if (show)
|
|||
|
{
|
|||
|
if (_OpenBtnAnimator.gameObject.activeSelf)
|
|||
|
_OpenBtnAnimator.Play("Show");
|
|||
|
//_BtnList.ShowBtns();
|
|||
|
if (_GridPanel.gameObject.activeSelf)
|
|||
|
_GridPanel.Play("ShowLeft");
|
|||
|
if (_GridPanel.GetComponent<CanvasGroup>() != null)
|
|||
|
{
|
|||
|
_GridPanel.GetComponent<CanvasGroup>().interactable = true;
|
|||
|
}
|
|||
|
if (SkillBarLogic.Instance())
|
|||
|
{
|
|||
|
SkillBarLogic.Instance().HideSkillBar();
|
|||
|
}
|
|||
|
//if (_BtnList._IsBtnTooMuch)
|
|||
|
//{
|
|||
|
// if (ChatFrameLogic.Instance())
|
|||
|
// {
|
|||
|
// ChatFrameLogic.Instance().HideChatFrame();
|
|||
|
// }
|
|||
|
// if (ExtraFunTipRoot.Instance())
|
|||
|
// {
|
|||
|
// ExtraFunTipRoot.Instance().HideBtnTips();
|
|||
|
// }
|
|||
|
//}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (_OpenBtnAnimator.gameObject.activeSelf)
|
|||
|
_OpenBtnAnimator.Play("Hide");
|
|||
|
//_BtnList.ShowBtns();
|
|||
|
if (_GridPanel.gameObject.activeSelf)
|
|||
|
_GridPanel.Play("HideLeft");
|
|||
|
|
|||
|
if (SkillBarLogic.Instance())
|
|||
|
{
|
|||
|
SkillBarLogic.Instance().ShowSkillBar();
|
|||
|
}
|
|||
|
if (_GridPanel.GetComponent<CanvasGroup>() != null)
|
|||
|
{
|
|||
|
_GridPanel.GetComponent<CanvasGroup>().interactable = false;
|
|||
|
}
|
|||
|
//if (_BtnList._IsBtnTooMuch)
|
|||
|
//{
|
|||
|
// if (ChatFrameLogic.Instance())
|
|||
|
// {
|
|||
|
// ChatFrameLogic.Instance().ShowChatFrame();
|
|||
|
// }
|
|||
|
// if (ExtraFunTipRoot.Instance())
|
|||
|
// {
|
|||
|
// ExtraFunTipRoot.Instance().ShowBtnTips();
|
|||
|
// }
|
|||
|
//}
|
|||
|
}
|
|||
|
_IsBtnShow = show;
|
|||
|
|
|||
|
EventDelayOperation();
|
|||
|
}
|
|||
|
|
|||
|
//处理一些收到协议的时候还没有打开UI的问题
|
|||
|
//使用在GlobalData中缓存的数据进行刷新
|
|||
|
void EventDelayOperation()
|
|||
|
{
|
|||
|
ShowRedIcon(FUNCTIONTYPE.CHILD, GameManager.gameManager.PlayerDataPool.ChildData._IsShowIconRedState);
|
|||
|
}
|
|||
|
|
|||
|
public GameObject GetBtn(string name, bool isGetHide = false)
|
|||
|
{
|
|||
|
if (_IsBtnShow || isGetHide)
|
|||
|
{
|
|||
|
foreach (var btn in _BtnList._Btns)
|
|||
|
{
|
|||
|
if(btn.gameObject.name.Equals(name))
|
|||
|
{
|
|||
|
return btn.gameObject;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public void OnBackPackClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.BackPackRoot);
|
|||
|
}
|
|||
|
|
|||
|
public void OnSoulClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.MeridiaSoulWnd);
|
|||
|
}
|
|||
|
|
|||
|
public void OnRankClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.RankRoot);
|
|||
|
}
|
|||
|
|
|||
|
public void OnChildClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.ChildPanel);
|
|||
|
}
|
|||
|
|
|||
|
public void OnPetClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.PetMainWndPath, delegate (bool bSuccess, object param)
|
|||
|
{
|
|||
|
|
|||
|
if (bSuccess && PetMainWnd.Instance != null)
|
|||
|
{
|
|||
|
PetMainWnd.Instance.ShowPage(0, 0);
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public void OnMagicClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.MagicWndPath);
|
|||
|
}
|
|||
|
|
|||
|
public void OnSkillClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.SkillInfo);
|
|||
|
}
|
|||
|
|
|||
|
public void OnAdvanceBtnClick(int type)
|
|||
|
{
|
|||
|
if (!AdvanceCanadvanceCtr.GetInstance().IsAdvanceFuncOpen(type))
|
|||
|
{
|
|||
|
//CG_REQ_ADVANCE req = (CG_REQ_ADVANCE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ADVANCE);
|
|||
|
//req.SetOptionType((int)AdvanceBase.ReqType.ADVANCE_OPTION);
|
|||
|
//req.SetType((int)type);
|
|||
|
//req.SetParam1(1); //自动购买
|
|||
|
//req.SetParam2(0);
|
|||
|
//req.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate (bool bSucess, object param)
|
|||
|
{
|
|||
|
if (bSucess)
|
|||
|
{
|
|||
|
AdvanceMountPanelCtr.Instance.SetAdvanceType(type);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public void OnGodWeaponClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate (bool bSucess, object param)
|
|||
|
{
|
|||
|
if (bSucess)
|
|||
|
{
|
|||
|
AdvanceMountPanelCtr.Instance.SetAdvanceType((int)AdvanceBase.AdvanceType.Piano);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
//打开帮会窗口
|
|||
|
public void OnGuildClick()
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.IsHaveGuild() == true)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.GuildMainInfoWnd);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.GuildMainWnd);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void OnActivityCick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.Activity);
|
|||
|
}
|
|||
|
|
|||
|
public void OnEquipClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.EquipEnhance);
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnMarryClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.MarryRoot);
|
|||
|
}
|
|||
|
|
|||
|
#region 提示
|
|||
|
|
|||
|
public enum RedType //对应FunctionOpen
|
|||
|
{
|
|||
|
Equip = 1, // 锻造
|
|||
|
Skill, // 技能
|
|||
|
Pet, //宠物
|
|||
|
GuildRed, // 帮派
|
|||
|
Marry, // 婚姻
|
|||
|
MeridiaSoul, // 境界
|
|||
|
Magic, // 法宝
|
|||
|
Ride, //坐骑
|
|||
|
Piano, // 竖琴
|
|||
|
Wing, // 翅膀
|
|||
|
Qilinbi, //麒麟臂
|
|||
|
Soul, // 魂器
|
|||
|
Mask, // 面具
|
|||
|
Huopao, //火炮
|
|||
|
}
|
|||
|
|
|||
|
//public GameObject[] RedTipPoints;
|
|||
|
public List<BtnFunc> _BtnFuncList;
|
|||
|
public GameObject _RedTipTotal;
|
|||
|
/// <summary>
|
|||
|
/// 设置左侧菜单红点信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="redType"></param>
|
|||
|
/// <param name="state"></param>
|
|||
|
public void SetRedTipState(RedType redType, bool state)
|
|||
|
{
|
|||
|
int index = (int)redType - 1;
|
|||
|
if (_BtnFuncList.Count <= index)
|
|||
|
return;
|
|||
|
if (_BtnFuncList[index] == null)
|
|||
|
return;
|
|||
|
|
|||
|
BtnFunc itemFunc = null;
|
|||
|
for (int _Index = 0; _Index < _BtnFuncList.Count; _Index++)
|
|||
|
{
|
|||
|
if (_BtnFuncList[_Index]._functionOpenId == (int)redType)
|
|||
|
{
|
|||
|
itemFunc = _BtnFuncList[_Index];
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (itemFunc == null)
|
|||
|
return;
|
|||
|
|
|||
|
switch (redType)
|
|||
|
{
|
|||
|
case RedType.GuildRed:
|
|||
|
{
|
|||
|
bool canShowRedPoint = false;
|
|||
|
// 职位是否可以接收红点
|
|||
|
GameDefine_Globe.GUILD_JOB myJob = (GameDefine_Globe.GUILD_JOB)GameManager.gameManager.PlayerDataPool.GuildInfo.GuildJob;
|
|||
|
if (myJob == GameDefine_Globe.GUILD_JOB.CHIEF
|
|||
|
|| myJob == GameDefine_Globe.GUILD_JOB.VICE_CHIEF
|
|||
|
|| myJob == GameDefine_Globe.GUILD_JOB.TANGZHU
|
|||
|
|| myJob == GameDefine_Globe.GUILD_JOB.XIANGZHU)
|
|||
|
{
|
|||
|
canShowRedPoint = true;
|
|||
|
}
|
|||
|
|
|||
|
bool hasApply = GameManager.gameManager.PlayerDataPool.GuildInfo.GuildApplyList.Count > 0 ? true : false;
|
|||
|
itemFunc.ShowRedIcon(hasApply && canShowRedPoint);
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
if (itemFunc.IsBtnOpen())
|
|||
|
{
|
|||
|
itemFunc.ShowRedIcon(state);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (redType >= RedType.Ride && redType <= RedType.Huopao)
|
|||
|
{
|
|||
|
var functioniOpenTab = TableManager.GetFunctionOpenByID((int)redType, 0);
|
|||
|
|
|||
|
if (functioniOpenTab.OpenLevel != 0)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= functioniOpenTab.OpenLevel
|
|||
|
&& (GameManager.gameManager.PlayerDataPool.FunctionOpenState.ContainsKey((int)redType)
|
|||
|
&& GameManager.gameManager.PlayerDataPool.FunctionOpenState[(int)redType])
|
|||
|
&& GameManager.gameManager.PlayerDataPool.m_AdvanceData.GetAdvanceLevel((int)redType - 8) == 0)
|
|||
|
{
|
|||
|
itemFunc.ShowRedIcon(true);
|
|||
|
}
|
|||
|
else
|
|||
|
itemFunc.ShowRedIcon(false);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Guide.Instance._FinishGuideID >= functioniOpenTab.ShowGUIDId
|
|||
|
&& (GameManager.gameManager.PlayerDataPool.FunctionOpenState.ContainsKey((int)redType)
|
|||
|
&& GameManager.gameManager.PlayerDataPool.FunctionOpenState[(int)redType])
|
|||
|
&& GameManager.gameManager.PlayerDataPool.m_AdvanceData.GetAdvanceLevel((int)redType - 8) == 0)
|
|||
|
{
|
|||
|
itemFunc.ShowRedIcon(true);
|
|||
|
}
|
|||
|
else
|
|||
|
itemFunc.ShowRedIcon(false);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
itemFunc.ShowRedIcon(false);
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
for(int _btnFuncItemIndex = 0; _btnFuncItemIndex <_BtnFuncList.Count; _btnFuncItemIndex++)
|
|||
|
{
|
|||
|
if(_BtnFuncList[_btnFuncItemIndex]._RedIcon
|
|||
|
&&_BtnFuncList[_btnFuncItemIndex]._RedIcon.activeSelf)
|
|||
|
{
|
|||
|
_RedTipTotal.SetActive(true);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
_RedTipTotal.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
//单独状态控制(这边忽略了功能是否开启以及是否完成了对应指引任务)
|
|||
|
//例如子女,只有有了子女才有状态,有状态的时候一定是开启的
|
|||
|
public void ShowRedIcon(FUNCTIONTYPE type, bool isShow)
|
|||
|
{
|
|||
|
var funcId = (int)type;
|
|||
|
|
|||
|
if(BtnList.Instance)
|
|||
|
{
|
|||
|
for(int index = 0; index < BtnList.Instance._Btns.Length; index++)
|
|||
|
{
|
|||
|
if(BtnList.Instance._Btns[index]._functionOpenId == funcId)
|
|||
|
{
|
|||
|
BtnList.Instance._Btns[index].ShowRedIcon(isShow);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设置进阶项Icon红点状态
|
|||
|
/// </summary>
|
|||
|
/// <param name="advanceType">进阶类型:AdvanceBase.AdvanceType</param>
|
|||
|
/// <param name="state">状态</param>
|
|||
|
public void SetAdvanceRedTipState(AdvanceBase.AdvanceType advanceType, bool state)
|
|||
|
{
|
|||
|
|
|||
|
int realType = -1;
|
|||
|
switch (advanceType)
|
|||
|
{
|
|||
|
case AdvanceBase.AdvanceType.Ride: realType = (int)RedType.Ride; break;
|
|||
|
case AdvanceBase.AdvanceType.Piano: realType = (int)RedType.Piano; break;
|
|||
|
case AdvanceBase.AdvanceType.Wing: realType = (int)RedType.Wing; break;
|
|||
|
case AdvanceBase.AdvanceType.Qilinbi: realType = (int)RedType.Qilinbi; break;
|
|||
|
case AdvanceBase.AdvanceType.Soul: realType = (int)RedType.Soul; break;
|
|||
|
case AdvanceBase.AdvanceType.Mask: realType = (int)RedType.Mask; break;
|
|||
|
case AdvanceBase.AdvanceType.Huopao: realType = (int)RedType.Huopao; break;
|
|||
|
}
|
|||
|
|
|||
|
if (realType != -1)
|
|||
|
{
|
|||
|
SetRedTipState((RedType)realType, state);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateRedTips()
|
|||
|
{
|
|||
|
EquipEnhanceRoot.UpdateFucntionPanel();
|
|||
|
}
|
|||
|
|
|||
|
public GameObject _BackPackFullTip1;
|
|||
|
public GameObject _BackPackFullTip2;
|
|||
|
public void UpdateBackPackFull()
|
|||
|
{
|
|||
|
GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
|
|||
|
if (BackPack.GetCanContainerSize() == 0)
|
|||
|
{
|
|||
|
_BackPackFullTip1.SetActive(true);
|
|||
|
_BackPackFullTip2.SetActive(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_BackPackFullTip1.SetActive(false);
|
|||
|
_BackPackFullTip2.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnSettingBtnClick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.SystemAndAutoFight);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region funOpen
|
|||
|
|
|||
|
public BtnFunc _EquipFunc;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region OnFunctionbtnClick
|
|||
|
public enum FUNCTIONTYPE
|
|||
|
{
|
|||
|
EQUIP = 1,
|
|||
|
SKILL,
|
|||
|
PET,
|
|||
|
GUILD,
|
|||
|
MARRY,
|
|||
|
SOUL,
|
|||
|
FABAO,
|
|||
|
ADVANCEMOUNT, // 坐骑
|
|||
|
ADVANCEGODWEAPON, // 神石 -> 竖琴
|
|||
|
ADVANCEWING, // 翅膀
|
|||
|
ADVANCERING, // 神环 -> 神戒
|
|||
|
ADVANCESOUL, // 王冠 -> 魂器
|
|||
|
ADVANCEMASK, // 面具
|
|||
|
ADVANCEHUOPAO, // 战旗 -> 火炮
|
|||
|
RANK,
|
|||
|
CHILD = 20, //子女养成
|
|||
|
}
|
|||
|
public void OnFunctionBtnClick(int functionOpenTabId)
|
|||
|
{
|
|||
|
StartCoroutine(ShowFunctionPanel(functionOpenTabId));
|
|||
|
}
|
|||
|
|
|||
|
IEnumerator ShowFunctionPanel(int functionOpenTabId)
|
|||
|
{
|
|||
|
yield return new WaitForEndOfFrame();
|
|||
|
switch (functionOpenTabId)
|
|||
|
{
|
|||
|
case (int)FUNCTIONTYPE.EQUIP:
|
|||
|
OnEquipClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.SKILL:
|
|||
|
OnSkillClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.PET:
|
|||
|
OnPetClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.GUILD:
|
|||
|
OnGuildClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.MARRY:
|
|||
|
OnBtnMarryClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.SOUL:
|
|||
|
OnSoulClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.FABAO:
|
|||
|
OnMagicClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.ADVANCEMOUNT:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCEWING:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCEMASK:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCEGODWEAPON:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCERING:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCEHUOPAO:
|
|||
|
case (int)FUNCTIONTYPE.ADVANCESOUL:
|
|||
|
{
|
|||
|
OnAdvanceBtnClick(functionOpenTabId - 8);
|
|||
|
}
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.RANK:
|
|||
|
OnRankClick();
|
|||
|
break;
|
|||
|
case (int)FUNCTIONTYPE.CHILD:
|
|||
|
OnChildClick();
|
|||
|
break;
|
|||
|
}
|
|||
|
yield break;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|