327 lines
12 KiB
C#
327 lines
12 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using System;
|
|||
|
|
|||
|
public class ActivityBtn : MonoBehaviour
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
public Image Icon;
|
|||
|
public TimeDownText TiemDown;
|
|||
|
public GameObject EffectObj;
|
|||
|
|
|||
|
private ActivityDataManager.ActivityData m_activityData;
|
|||
|
public bool Refresh(int activiyType)
|
|||
|
{
|
|||
|
if(gameObject.activeSelf && m_activityData!=null && m_activityData.activityTab != null && m_activityData.activityServerType == activiyType)
|
|||
|
{
|
|||
|
Show(m_activityData);
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
public void HideEffect(bool state)
|
|||
|
{
|
|||
|
var isShow = !state;
|
|||
|
if(isShow)
|
|||
|
{
|
|||
|
//只有门派挑战匹配时才显示
|
|||
|
if (m_activityData.activityServerType != (int)ActivityDataManager.Activity_Type.ACTIVITY_FACTIONADVANCE)
|
|||
|
{
|
|||
|
EffectObj.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
EffectObj.SetActive(GameManager.gameManager.PlayerDataPool.IsFactionAdvanceAutoMtach);
|
|||
|
}else
|
|||
|
EffectObj.SetActive(false);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Show(ActivityDataManager.ActivityData activityData)
|
|||
|
{
|
|||
|
if(activityData == null || activityData.activityTab == null || activityData.activityState == (int)ActivityDataManager.ActivityState.None || activityData.BossLeaveCount == 0 || GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < activityData.activityTab.Level)
|
|||
|
{
|
|||
|
gameObject.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_BANQUET)
|
|||
|
{
|
|||
|
var fuben = TableManager.GetFubenByID(GlobeVar.BANQUETFUBENID, 0);
|
|||
|
if (fuben == null || GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < fuben.PlayerLevelMin)
|
|||
|
{
|
|||
|
gameObject.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
m_activityData = activityData;
|
|||
|
|
|||
|
if (activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_FACTIONADVANCE &&
|
|||
|
ActiveBtns.Instance()
|
|||
|
&& ActiveBtns.Instance()._ShowPanel)
|
|||
|
HideEffect(false);
|
|||
|
|
|||
|
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(Icon, m_activityData.activityTab.Icon);
|
|||
|
int timeEnd = m_activityData.EndTime - GlobalData.ServerAnsiTime;
|
|||
|
if (m_activityData.activityState == ActivityDataManager.ActivityState.Playing)
|
|||
|
{
|
|||
|
L_ReqForbiddenTopGetInfo();
|
|||
|
string StrDicID = "#{22010}";
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.CROSS_SER_ESCORT_DOUBLE)
|
|||
|
{
|
|||
|
StrDicID = "#{59009}";
|
|||
|
}
|
|||
|
|
|||
|
if (timeEnd > 0)
|
|||
|
{
|
|||
|
TiemDown.Init("", (int)Time.realtimeSinceStartup + timeEnd, 0, -1, null, TimeDownText.TimeFormat.english);
|
|||
|
TiemDown.SetTipText(StrDictionary.GetClientDictionaryString(StrDicID) + "\n{0}");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_BANQUET)
|
|||
|
TiemDown.Init("");
|
|||
|
else
|
|||
|
TiemDown.Init(StrDictionary.GetClientDictionaryString(StrDicID));
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
else if (m_activityData.activityState == ActivityDataManager.ActivityState.Prepare)
|
|||
|
{
|
|||
|
if (timeEnd > 0)
|
|||
|
{
|
|||
|
TiemDown.Init("", (int)Time.realtimeSinceStartup + timeEnd, 0, -1, null, TimeDownText.TimeFormat.english);
|
|||
|
TiemDown.SetTipText(StrDictionary.GetClientDictionaryString("#{22011}") + "\n{0}");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
TiemDown.Init(StrDictionary.GetClientDictionaryString("#{22011}"));
|
|||
|
}
|
|||
|
}
|
|||
|
else if (m_activityData.activityState == ActivityDataManager.ActivityState.SignTimeDown && timeEnd > 0) //报名倒计时
|
|||
|
{
|
|||
|
TiemDown.Init("", (int)Time.realtimeSinceStartup + timeEnd, 0, 22016, null, TimeDownText.TimeFormat.english);
|
|||
|
}
|
|||
|
else if (m_activityData.activityState == ActivityDataManager.ActivityState.StartTimeDown && timeEnd > 0) //进行倒计时
|
|||
|
{
|
|||
|
TiemDown.Init("", (int)Time.realtimeSinceStartup + timeEnd, 0, 22017, null, TimeDownText.TimeFormat.english);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
L_ReqForbiddenTopGetInfo();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void Click_Btn()
|
|||
|
{
|
|||
|
|
|||
|
if (m_activityData == null || m_activityData.activityState == ActivityDataManager.ActivityState.None || m_activityData.activityTab==null)
|
|||
|
return;
|
|||
|
if(m_activityData.activityState == ActivityDataManager.ActivityState.Prepare)
|
|||
|
{
|
|||
|
if(m_activityData.activityTab.BeginSoonTipID!=-1)
|
|||
|
MessageHelpLogic.ShowHelpMessage(m_activityData.activityTab.BeginSoonTipID);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//紫禁之巅
|
|||
|
if (m_activityData.activityTab.Id == 37)
|
|||
|
{
|
|||
|
if (siWangCount < _siWangMaxCount)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{79509}"), null, delegate ()
|
|||
|
{
|
|||
|
ReqEnterForbiddenTop req = new ReqEnterForbiddenTop();
|
|||
|
req.Flag = 1;
|
|||
|
req.SendMsg();
|
|||
|
},
|
|||
|
null);
|
|||
|
return;
|
|||
|
}
|
|||
|
//if (siWangCount >= _siWangMaxCount)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{79501}"));
|
|||
|
//ReqEnterForbiddenTop req = new ReqEnterForbiddenTop();
|
|||
|
//req.Flag = 1;
|
|||
|
//req.SendMsg();
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_PVP)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.SportsPanel, delegate (bool bSucess, object param) {
|
|||
|
if (bSucess)
|
|||
|
{
|
|||
|
SportsPanel.Instance.OnMenuItemClick((int)SportsPanel.SportsType.Pvp);
|
|||
|
}
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if(m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_FACTIONADVANCE)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level == 0)
|
|||
|
return;
|
|||
|
|
|||
|
if (m_activityData.activityTab.Level > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5704}", m_activityData.activityTab.Level));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
UIManager.ShowUI(UIInfo.FactionAdvancePanel);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_BANQUET)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.PartInWeedingBanquetPanel);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_TOMBRAIDER)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(5703, -1,
|
|||
|
() =>
|
|||
|
{
|
|||
|
TombRaiderTipPanelCtr.HasShow = false;
|
|||
|
GCGame.Utils.EnterCopy(6059);
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
/*if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.CROSS_SER_CAPTUREFLAG)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(5703, -1,
|
|||
|
() =>
|
|||
|
{
|
|||
|
TombRaiderTipPanelCtr.HasShow = false;
|
|||
|
GCGame.Utils.EnterCopy(6059);
|
|||
|
});
|
|||
|
return;
|
|||
|
}*/
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_FEAST)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{28006}"));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GameManager.gameManager.AutoSearch.BackGuild(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid, -1, 0, 0);
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_TREASURE_GLOD)
|
|||
|
{
|
|||
|
CG_TREASURE_GOLD_OPTION send = (CG_TREASURE_GOLD_OPTION)PacketDistributed.CreatePacket(MessageID.PACKET_CG_TREASURE_GOLD_OPTION);
|
|||
|
send.SetOptiontype(5);
|
|||
|
send.SendPacket();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_WORLD_BOSS)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.WorldBoss);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_BOSS)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.Boss, delegate (bool bSuccess, object param)
|
|||
|
{
|
|||
|
BossUI worldBoss = UIManager.GetUIComponent<BossUI>(UIInfo.Boss);
|
|||
|
if (worldBoss != null)
|
|||
|
{
|
|||
|
worldBoss.ShowPage(0);
|
|||
|
}
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_CROSSSERVERBOSS)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.Boss, delegate (bool bSuccess, object param)
|
|||
|
{
|
|||
|
BossUI worldBoss = UIManager.GetUIComponent<BossUI>(UIInfo.Boss);
|
|||
|
if (worldBoss != null)
|
|||
|
{
|
|||
|
worldBoss.ShowPage(3);
|
|||
|
}
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_GUILD_UNION_MATCH || m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_GUILDPROBBERS)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{6707}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_GUILDPROBBERS)
|
|||
|
{
|
|||
|
Tab_GuildOther guildOther = TableManager.GetGuildOtherByID(0, 0);
|
|||
|
if (guildOther == null || GameManager.gameManager.PlayerDataPool.GuildInfo.GuildLevel < guildOther.RobberNeedGuildLevel)
|
|||
|
{
|
|||
|
PlayHelpMessageRoot.ShowHelpMessage(3);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if(m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_FIGHTYARD)
|
|||
|
{
|
|||
|
//GuanningRegistLogic.InitGuanningRegist();
|
|||
|
if (m_activityData.activityTab.BeginSoonTipID != -1)
|
|||
|
MessageHelpLogic.ShowHelpMessage(m_activityData.activityTab.BeginSoonTipID);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (m_activityData.activityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_GUILD_UNION_MATCH)
|
|||
|
{
|
|||
|
ActiveGuildMatch();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
ActivityController.ClickActive(m_activityData.activityTab.Id);
|
|||
|
}
|
|||
|
|
|||
|
#region 紫荆之巅协议
|
|||
|
public void L_ReqForbiddenTopGetInfo()
|
|||
|
{
|
|||
|
ReqForbiddenTopGetInfo reqNew = new ReqForbiddenTopGetInfo();
|
|||
|
reqNew.Flag = 1;
|
|||
|
reqNew.SendMsg();
|
|||
|
}
|
|||
|
public int _siWangMaxCount = 10;
|
|||
|
public static int siWangCount = -1;
|
|||
|
public static void TheNumberOfDeath(RespForbiddenTopGetInfo binaryMsg)
|
|||
|
{
|
|||
|
siWangCount = binaryMsg.DeadCount;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
void ActiveGuildMatch()
|
|||
|
{
|
|||
|
if (GameManager.gameManager.RunningScene != GlobeVar.GUILDMATCH_MAINFUBENID && ActivityDataManager.Instance.IsActivityState((int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_GUILD_UNION_MATCH, ActivityDataManager.ActivityState.Playing))
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{29036}"), null, delegate ()
|
|||
|
{
|
|||
|
GCGame.Utils.EnterCopy((int)GameDefine_Globe.SCENE_DEFINE.SCENE_GUILDWARMAIN);
|
|||
|
},
|
|||
|
null);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{25137}"));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|