417 lines
12 KiB
C#
417 lines
12 KiB
C#
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using System.Collections;
|
||
using Games.Item;
|
||
using System.Collections.Generic;
|
||
using GCGame.Table;
|
||
|
||
public class ExtraFunTipRoot : UIControllerBase<ExtraFunTipRoot>
|
||
{
|
||
public GameObject _Offset;
|
||
public GameObject _MeridiaSoul; // 经脉提示
|
||
public GameObject _Kungfu; // 武魂提示
|
||
public GameObject _Heart; // 心法提示
|
||
public GameObject _ShihunTip; // 装备失魂
|
||
public GameObject _FixTip; // 装备修理
|
||
public GameObject _TianghuaTip;
|
||
public GameObject _MissionAward_Day; // 日跑环奖励
|
||
public GameObject _MissionAward_Week; // 周跑环奖励
|
||
public GameObject _EquipFrenzy; // 装备狂化
|
||
public GameObject _Medicine; // 玩家可携带的自动回血/回蓝药品
|
||
public int _MedicineDescID = -1; // 药品提示用的字典ID
|
||
|
||
public List<AdvanceTypeIcon> advanceTypeIconList = new List<AdvanceTypeIcon>();
|
||
|
||
public void OnEnable()
|
||
{
|
||
SetInstance(this);
|
||
StartCoroutine(InitShowInfo());
|
||
}
|
||
|
||
IEnumerator InitShowInfo()
|
||
{
|
||
yield return new WaitForEndOfFrame();
|
||
|
||
UpdateEquipFunTip();
|
||
UpdateEquipEnhance();
|
||
UpdateMissionAward();
|
||
UpdateMerial();
|
||
UpdateFrenzy();
|
||
UpdateAdvanceFuncTip();
|
||
|
||
yield break;
|
||
}
|
||
|
||
public void ShowBtnTips()
|
||
{
|
||
if (_Offset)
|
||
_Offset.SetActive(true);
|
||
}
|
||
|
||
public void HideBtnTips()
|
||
{
|
||
if (_Offset)
|
||
_Offset.SetActive(false);
|
||
}
|
||
|
||
public void OnDisable()
|
||
{
|
||
SetInstance(null);
|
||
}
|
||
|
||
#region equip
|
||
|
||
private GameItem _NeedExchangeEquipA;
|
||
private GameItem _NeedExchangeEquipB;
|
||
private GameItem _UnfixableEquip;
|
||
|
||
public void UpdateEquipFunTip()
|
||
{
|
||
if (!FunctionExLogic.Instance())
|
||
return;
|
||
|
||
GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
|
||
List<GameItem> backpackItems = ItemTool.ItemFilter(BackPack, 0);
|
||
GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack;
|
||
List<GameItem> equipPackItems = ItemTool.ItemFilter(EquipPack, 0);
|
||
|
||
bool isShihun = false;
|
||
bool isFix = false;
|
||
bool enhanceExchange = false;
|
||
_NeedExchangeEquipA = null;
|
||
_NeedExchangeEquipB = null;
|
||
foreach (var itemInfo in backpackItems)
|
||
{
|
||
if (itemInfo.IsEquipMent())
|
||
{
|
||
if (itemInfo.ShihunTime > 0)
|
||
{
|
||
isShihun = true;
|
||
}
|
||
if (itemInfo.Durable == 0)
|
||
{
|
||
|
||
if (PlayerPreferenceData.AutoRefitEquip)
|
||
{
|
||
if (!itemInfo.EquipRefit((int)GameItemContainer.Type.TYPE_BACKPACK))
|
||
{
|
||
_UnfixableEquip = itemInfo;
|
||
isFix = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
isFix = true;
|
||
}
|
||
}
|
||
//if (itemInfo.StrengthLevel > 0)
|
||
//{
|
||
|
||
// GameItemContainer equipPack = GameManager.gameManager.PlayerDataPool.EquipPack;
|
||
// foreach (var equip in equipPack.Items)
|
||
// {
|
||
// if (equip.StrengthLevel < itemInfo.StrengthLevel)
|
||
// {
|
||
// _NeedExchangeEquipA = itemInfo;
|
||
// _NeedExchangeEquipB = equip;
|
||
// enhanceExchange = true;
|
||
// break;
|
||
// }
|
||
// }
|
||
|
||
//}
|
||
|
||
}
|
||
}
|
||
|
||
foreach (var itemInfo in equipPackItems)
|
||
{
|
||
if (itemInfo.IsEquipMent())
|
||
{
|
||
if (itemInfo.ShihunTime > 0)
|
||
{
|
||
isShihun = true;
|
||
}
|
||
if (itemInfo.Durable == 0)
|
||
{
|
||
if (PlayerPreferenceData.AutoRefitEquip)
|
||
{
|
||
if (!itemInfo.EquipRefit((int)GameItemContainer.Type.TYPE_EQUIPPACK))
|
||
{
|
||
_UnfixableEquip = itemInfo;
|
||
isFix = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
isFix = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (isShihun)
|
||
{
|
||
_ShihunTip.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_ShihunTip.SetActive(false);
|
||
}
|
||
|
||
if (isFix)
|
||
{
|
||
_FixTip.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_FixTip.SetActive(false);
|
||
}
|
||
}
|
||
|
||
public void UpdateMerial()
|
||
{
|
||
_MeridiaSoul.SetActive(MeridiaSoulData.Instance.MerialSoulHasUp);
|
||
_Kungfu.SetActive(MeridiaSoulData.Instance.KungfuHasUp);
|
||
_Heart.SetActive(MeridiaSoulData.Instance.HeartHasUp);
|
||
}
|
||
|
||
//打开境界界面
|
||
public void OnBtnOpenMerial(int index)
|
||
{
|
||
UIManager.ShowUI(UIInfo.MeridiaSoulWnd, delegate (bool bSuccess, object param)
|
||
{
|
||
if (bSuccess)
|
||
{
|
||
MeridiaSoulMain.Instance._TagPanel.ShowPage((int)param);
|
||
}
|
||
},
|
||
index);
|
||
}
|
||
|
||
public void OnBtnBackPack()
|
||
{
|
||
UIManager.ShowUI(UIInfo.BackPackRoot);
|
||
}
|
||
|
||
public void OnMedicineBtnClick()
|
||
{
|
||
int shopID = 2;
|
||
_Medicine.gameObject.SetActive(false);
|
||
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{" + _MedicineDescID + "}"), null,
|
||
() =>
|
||
{
|
||
//Tab_SceneClass curSceneTab = TableManager.GetSceneClassByID(GameManager.gameManager.RunningScene, 0);
|
||
//if (curSceneTab.Type != 1 && curSceneTab.Type != 0)
|
||
//{
|
||
// GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{" + 71002 + "}"));
|
||
// return;
|
||
//}
|
||
|
||
//Tab_AutoSearch autoSearch = TableManager.GetAutoSearchByID(1, 0);
|
||
//if (autoSearch == null)
|
||
//{
|
||
// return;
|
||
//}
|
||
////接受任务后自动寻路
|
||
//Vector3 targetPos = new Vector3();
|
||
//targetPos.x = autoSearch.X;
|
||
//targetPos.z = autoSearch.Z;
|
||
//int nTargetScene = autoSearch.DstSceneID;
|
||
//AutoSearchPoint point = new AutoSearchPoint(nTargetScene, targetPos.x, targetPos.z);
|
||
//if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
|
||
//{
|
||
// GameManager.gameManager.AutoSearch.BuildPath(point);
|
||
// Tab_RoleBaseAttr RoleBase = TableManager.GetRoleBaseAttrByID(autoSearch.DataId, 0);
|
||
// // 确定NPC存在,并且寻路信息已经构建
|
||
// if (null != RoleBase && null != GameManager.gameManager.AutoSearch.Path)
|
||
// {
|
||
// GameManager.gameManager.AutoSearch.Path.AutoSearchTargetName = RoleBase.Name;
|
||
// GameManager.gameManager.AutoSearch.Path.autoSearchRadius = RoleBase.DialogRadius;
|
||
// UIManager.CloseUI(UIInfo.Activity);
|
||
// }
|
||
//}
|
||
SysShopController.ShowShop(shopID, true);
|
||
},
|
||
|
||
disableCallBack: () =>
|
||
{
|
||
ExtraFunTipRoot.Instance()._Medicine.SetActive(true);
|
||
});
|
||
}
|
||
|
||
public void OnBtnFix()
|
||
{
|
||
if (_UnfixableEquip != null)
|
||
{
|
||
foreach (var attr in _UnfixableEquip.ExAttrs)
|
||
{
|
||
if (attr.XilianTab.PropID == (int)PropID.PropertyID.EQUIP_XILIAN_NOREFIT)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5375}"));
|
||
}
|
||
}
|
||
}
|
||
|
||
UIManager.ShowUI(UIInfo.BackPackRoot);
|
||
}
|
||
|
||
public void UpdateFrenzy()
|
||
{
|
||
_EquipFrenzy.gameObject.SetActive(EquipFrenzy.HasAnyFrenzy);
|
||
}
|
||
|
||
public void ShowEuipFrenzy()
|
||
{
|
||
UIManager.ShowUI(UIInfo.EquipEnhance, delegate (bool bSucess, object param)
|
||
{
|
||
if (bSucess)
|
||
{
|
||
EquipEnhanceRoot.Instance().TryOpen(3);
|
||
}
|
||
});
|
||
}
|
||
|
||
public void UpdateEquipEnhance()
|
||
{
|
||
if (!FunctionExLogic.Instance())
|
||
return;
|
||
|
||
if (!FunctionExLogic.Instance()._EquipFunc.IsBtnOpen())
|
||
return;
|
||
|
||
if (EquipEnhanceRoot.CanAnyEquipQianhua())
|
||
{
|
||
_TianghuaTip.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_TianghuaTip.SetActive(false);
|
||
}
|
||
}
|
||
|
||
public void OnEquipEnhance()
|
||
{
|
||
EquipEnhanceRoot.ShowEquipQianhua();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region mission award
|
||
|
||
public void UpdateMissionAward()
|
||
{
|
||
// 每日跑环奖励
|
||
if (GameManager.gameManager.CircleMissionManager.LastAwardCntByType(CircleMissionManager.CircleType.daily) > 0
|
||
|| GameManager.gameManager.CircleMissionManager.CurStateByType(CircleMissionManager.CircleType.daily) == 2)
|
||
{
|
||
_MissionAward_Day.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_MissionAward_Day.SetActive(false);
|
||
}
|
||
|
||
// 每周跑环奖励
|
||
if (GameManager.gameManager.CircleMissionManager.LastAwardCntByType(CircleMissionManager.CircleType.weekly) > 0
|
||
|| GameManager.gameManager.CircleMissionManager.CurStateByType(CircleMissionManager.CircleType.daily) == 2)
|
||
{
|
||
_MissionAward_Week.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_MissionAward_Week.SetActive(false);
|
||
}
|
||
}
|
||
|
||
// 每日跑环奖励
|
||
public void OnBtnCirclrAward_Day()
|
||
{
|
||
UIManager.ShowUI(UIInfo.MissionCircleAward_Day);
|
||
}
|
||
|
||
// 每周跑环奖励
|
||
public void OnBtnCirclrAward_Week()
|
||
{
|
||
UIManager.ShowUI(UIInfo.MissionCircleAward_Week);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Advance
|
||
|
||
public void UpdateAdvanceFuncTip()
|
||
{
|
||
if (AdvanceCanadvanceCtr.GetInstance() != null)
|
||
{
|
||
AdvanceCanadvanceCtr.GetInstance().JudgeShowCanAdvanceIcon();
|
||
}
|
||
else
|
||
{
|
||
for (int index = 0; index < advanceTypeIconList.Count; index++)
|
||
{
|
||
advanceTypeIconList[index].gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void ShowOrHideTypeIcon(List<int> needShowTypeIconList)
|
||
{
|
||
for (int index = 0; index < advanceTypeIconList.Count; index++)
|
||
{
|
||
advanceTypeIconList[index].gameObject.SetActive(needShowTypeIconList.Contains((int)(advanceTypeIconList[index].advanceType)));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region role level
|
||
|
||
public GameObject _BtnLevel;
|
||
|
||
public void UpdateRoleLevel()
|
||
{
|
||
// 为了修复在当前经验可升级,显示了图标,再用GM升到满级,图标不消失的Bug
|
||
_BtnLevel.SetActive(false);
|
||
var playerBaseAttr = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr;
|
||
var curTabLevelup = TableManager.GetLevelUpByID(playerBaseAttr.Level, 0);
|
||
if (null == curTabLevelup)
|
||
return;
|
||
var maxExp = long.Parse(curTabLevelup.ExpNeed);
|
||
_BtnLevel.SetActive(playerBaseAttr.Exp >= maxExp);
|
||
}
|
||
|
||
public void ClickRoleLevel()
|
||
{
|
||
UIManager.ShowUI(UIInfo.RoleView);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region ChatExpandOperation
|
||
public void OperationOffsetPos(float _ChangeValue)
|
||
{
|
||
_Offset.gameObject.transform.localPosition = new Vector3(_Offset.gameObject.transform.localPosition.x,
|
||
_Offset.gameObject.transform.localPosition.y +
|
||
_ChangeValue, _Offset.gameObject.transform.localPosition.z);
|
||
}
|
||
#endregion
|
||
|
||
#region mail
|
||
public GameObject _MailIcon;
|
||
public void ShowMailIcon(bool isShow)
|
||
{
|
||
_MailIcon.SetActive(isShow);
|
||
}
|
||
|
||
public void OnMailIconClick()
|
||
{
|
||
UIManager.ShowUI(UIInfo.FriendAndMail, delegate(bool bSucess, object param) {
|
||
if(bSucess)
|
||
{
|
||
FriendAndMailRoot.Instance()._TagPanel.ShowPage(3);
|
||
}
|
||
});
|
||
}
|
||
#endregion
|
||
}
|