using UnityEngine; using UnityEngine.UI; using System.Collections; using Games.Item; using GCGame.Table; using Games.GlobeDefine; public class GuildBossInfo : UIItemSelect { public class BossInfo { public int LevelId = -1; public int CallState = 0; public int authority = 1; public int index = 0; } public Text Level; public Text CallLevel; public Text Killed; public Button CallBtn; public Button EnterBtn; public Button ApplyMemberBtn; public Text ApplyMemText; private float TimeDown; private int ModelDuty = -1; private int OldModelID = -1; private void Update() { if(ModelDuty > 0) { ModelDuty--; if (ModelDuty == 0) { ModelDuty = -1; Tab_GuildBossConfig guildBoss = TableManager.GetGuildBossConfigByID(m_BossInfo.LevelId, 0); if (guildBoss == null) return; if (OldModelID != -1 && OldModelID == guildBoss.ModelID) return; OldModelID = guildBoss.ModelID; Tab_CharModel charModel = TableManager.GetCharModelByID(guildBoss.ModelID, 0); if (charModel != null) { m_BossModel.InitModelPath(charModel.ResPath, charModel, LoadAssetBundle.BUNDLE_PATH_MODEL, true, delegate () { ShowModel(); }); } } } if(TimeDown < 0) { if (ApplyMemberBtn.interactable == false) { ApplyMemberBtn.interactable = true; ApplyMemText.text = "" + StrDictionary.GetClientDictionaryString("#{24997}") + ""; } return; } if(TimeDown>0) { ApplyMemText.text = "" + string.Format("{0}({1}s)", StrDictionary.GetClientDictionaryString("#{24997}"), Mathf.FloorToInt(TimeDown)) + ""; } TimeDown -= Time.deltaTime; } public UICameraTexture m_BossModel; BossInfo m_BossInfo; public override void Show(Hashtable hash) { m_BossInfo = hash["InitObj"] as BossInfo; if (m_BossInfo == null) return; Tab_GuildBossConfig guildBoss = TableManager.GetGuildBossConfigByID(m_BossInfo.LevelId, 0); if (guildBoss == null) return; Level.text = guildBoss.Name; CallLevel.text = StrDictionary.GetClientDictionaryString("#{25077}", "", guildBoss.NeedGuildLevel); bool needLevel = (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildLevel >= guildBoss.NeedGuildLevel); CallLevel.transform.parent.gameObject.SetActive(!needLevel); CallBtn.gameObject.SetActive(needLevel && (m_BossInfo.CallState == 0 || m_BossInfo.CallState == 3)); CallBtn.interactable = (m_BossInfo.CallState != 3); Killed.gameObject.SetActive(m_BossInfo.CallState == 2); EnterBtn.gameObject.SetActive(needLevel && m_BossInfo.CallState == 1); ApplyMemberBtn.gameObject.SetActive(needLevel && m_BossInfo.authority==1 && m_BossInfo.CallState == 1); ApplyMemText.text = StrDictionary.GetClientDictionaryString("#{24997}"); ModelDuty = m_BossInfo.index; if (ModelDuty <= 0) ModelDuty++; base.Show(); } private void ShowModel() { m_BossModel.gameObject.SetActive(true); Tab_GuildBossConfig guildBoss = TableManager.GetGuildBossConfigByID(m_BossInfo.LevelId, 0); if (guildBoss == null) return; bool needLevel = (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildLevel >= guildBoss.NeedGuildLevel); if (needLevel == false) m_BossModel.SetBlack(); } private void AskBossInfo(int type) { if (m_BossInfo == null) return; CG_REQ_GUILDBOSS_OPERATE send = (CG_REQ_GUILDBOSS_OPERATE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_GUILDBOSS_OPERATE); send.Operate = type; send.Parm = m_BossInfo.LevelId; send.SendPacket(); } public void CallBoss() { if (ActivityDataManager.Instance.IsActivityState((int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_GUIDBOSS, ActivityDataManager.ActivityState.Playing) == false) { GUIData.AddNotifyData("#{24994}"); return; } if (m_BossInfo.authority!=1) { GUIData.AddNotifyData("#{24995}"); return; } MessageBoxLogic.OpenOKCancelBox(GCGame.Table.StrDictionary.GetClientDictionaryString("#{24993}"), "", delegate () { AskBossInfo(1); }); } public void EnterCopy() { AskBossInfo(3); } public void ApplyMember() { AskBossInfo(2); ApplyMemberBtn.interactable = false; TimeDown = 5; } }