827 lines
30 KiB
C#
827 lines
30 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
using System;
|
|
|
|
public class BossUI : UIControllerBase<BossUI>
|
|
{
|
|
#region static
|
|
|
|
public static void ShowUI()
|
|
{
|
|
UIManager.ShowUI(UIInfo.Boss);
|
|
}
|
|
|
|
#endregion
|
|
|
|
public class BossInfo
|
|
{
|
|
public int BossID;
|
|
public int bossType; //0个人BOSS 1世界BOSS 2BOSS之家 3跨服BOSS
|
|
public string bossName;
|
|
public int bossLevel;
|
|
public int bossModelID;
|
|
public string bossBack;
|
|
public bool isKilled;
|
|
public int reliveTime; //复活倒计时 等于0表示已刷新
|
|
public int ActivityValue;
|
|
public string Reward1; //奖励列表1
|
|
public string Reward2; //奖励列表2
|
|
public int NoPayTimes; //1 不消耗奖励次数 0消耗奖励次数
|
|
public int FubenID;
|
|
public int SceneID;
|
|
public float PosX;
|
|
public float PosZ;
|
|
public int LeaveBlood;
|
|
public string bossDesc;
|
|
public int VipFreeEnter; //VIP免费进等级
|
|
public int ConsumType;
|
|
public int ConsumSubType;
|
|
public int ConsumCount;
|
|
|
|
public BossInfo()
|
|
{
|
|
Clear();
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
BossID = -1;
|
|
bossType = -1;
|
|
bossName = "";
|
|
bossLevel = -1;
|
|
bossModelID = -1;
|
|
bossBack = "";
|
|
isKilled = false;
|
|
reliveTime = 0;
|
|
Reward1 = "";
|
|
Reward2 = "";
|
|
FubenID = -1;
|
|
SceneID = -1;
|
|
PosX = 0;
|
|
PosZ = 0;
|
|
LeaveBlood = 100;
|
|
bossDesc = "";
|
|
VipFreeEnter = 0;
|
|
NoPayTimes = 0;
|
|
}
|
|
}
|
|
|
|
public GameObject DescriptBtn;
|
|
public GameObject DescriptBtn1;
|
|
public GameObject HistorKillerObj;
|
|
public GameObject ScoreBtnObj;
|
|
public GameObject HistorKillTip;
|
|
public Text HistoryKillItem;
|
|
|
|
public GameObject Reward1Obj;
|
|
public GameObject Reward2Obj;
|
|
public GameObject Reward1child2;
|
|
public GameObject Reward1child1;
|
|
|
|
public Text BossLeaveBlood;
|
|
public Text Desc; //跨服BOSS和个人BOSS的描述
|
|
public Text Desc2;//BOSS之家
|
|
public Text ActivtyValue;//活力值消耗
|
|
public Text VipFree;//VIP免费次数
|
|
public Text BookRewardTimes;//图鉴奖励次数
|
|
public Text LastKillRewardTimes;//最后一击奖励次数
|
|
public Text JoinRewardTimes;//参与奖励次数
|
|
public GameObject m_WorldBossReward;
|
|
public GameObject NoPay;
|
|
public GameObject AwardDesc;
|
|
public UITagPanel _TagPanel;
|
|
public UIContainerSelect m_BossSceneLevels;
|
|
public UIContainerSelect m_BossList;
|
|
public RectTransform m_BossListRect;
|
|
public UICameraTexture m_BossModel;
|
|
public RectTransform m_MaskRect;
|
|
public Text JoinBtnText;
|
|
public Toggle AddFocus;
|
|
|
|
public GameObject WorldBossBtn;
|
|
public GameObject AwardBtn;
|
|
|
|
private string m_WorldBookRewardTimesAndMax;
|
|
private string m_WorldLastKillRewardTimesAndMax;
|
|
private string m_WorldJoinRewardTimesAndMax;
|
|
private string m_HomeBookRewardTimesAndMax;
|
|
private string m_HomeWorldLastKillRewardTimesAndMax;
|
|
private string m_HomeWorldJoinRewardTimesAndMax;
|
|
|
|
protected override void Init()
|
|
{
|
|
base.Init();
|
|
SetInstance(this);
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
WorldBossData.Instance.AskHomeBossInfo();
|
|
}
|
|
|
|
//请求世界BOSS和BOSS之家的历史被杀记录
|
|
public void AskHomeBossKillsInfo()
|
|
{
|
|
ReqBossHomeBossKillHistory cmd = new ReqBossHomeBossKillHistory();
|
|
cmd.bossid = m_CurrentSelect.BossID;
|
|
cmd.fubenid = m_CurrentSelect.FubenID;
|
|
cmd.SendMsg();
|
|
}
|
|
List<Text> m_historyInfos = new List<Text>();
|
|
public void HomeBossKillsInfo(AckBossHomeBossKillHistory homeBoss)
|
|
{
|
|
if (m_CurrentSelect == null)
|
|
return;
|
|
HistorKillTip.SetActive(true);
|
|
int index = 0;
|
|
for(int i=0;i<homeBoss.killer.Count;i++)
|
|
{
|
|
if (homeBoss.killtime.Count <= i)
|
|
continue;
|
|
if(m_historyInfos.Count<=i)
|
|
{
|
|
Text newText = GameObject.Instantiate<Text>(HistoryKillItem);
|
|
if(newText!=null)
|
|
{
|
|
newText.transform.SetParent(HistoryKillItem.transform.parent);
|
|
newText.transform.localPosition = HistoryKillItem.transform.localPosition;
|
|
newText.transform.localScale = HistoryKillItem.transform.localScale;
|
|
m_historyInfos.Add(newText);
|
|
}
|
|
}
|
|
index++;
|
|
m_historyInfos[i].gameObject.SetActive(true);
|
|
DateTime time = Utils.GetServerDateTime(homeBoss.killtime[i]);
|
|
m_historyInfos[i].text = StrDictionary.GetClientDictionaryString("#{49108}", time.ToString("HH:mm:ss"), homeBoss.killer[i]);
|
|
}
|
|
for(int i= index; i< m_historyInfos.Count; i++)
|
|
{
|
|
m_historyInfos[i].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void Show_WorldBoss()
|
|
{
|
|
if(m_CurrentSelect!=null)
|
|
{
|
|
if(m_WorldBossReward.activeSelf)
|
|
{
|
|
m_WorldBossReward.SetActive(false);
|
|
BossLeaveBlood.transform.parent.gameObject.SetActive(m_CurrentSelect.bossType != 0);
|
|
m_MaskRect.sizeDelta = new Vector2(730, 470);
|
|
AwardBtn.SetActive(true);
|
|
WorldBossBtn.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
m_WorldBossReward.SetActive(true);
|
|
AwardBtn.SetActive(false);
|
|
WorldBossBtn.SetActive(true);
|
|
BossLeaveBlood.transform.parent.gameObject.SetActive(false);
|
|
m_MaskRect.sizeDelta = Vector2.zero;
|
|
}
|
|
}
|
|
}
|
|
|
|
int m_CurrentAddFocusState = -1;
|
|
public void BossFocusState(RetBossHomeBossRssState rss)
|
|
{
|
|
if (m_CurrentSelect == null)
|
|
return;
|
|
if (m_CurrentSelect.FubenID != rss.fubenid || m_CurrentSelect.BossID != rss.bossid)
|
|
return;
|
|
AddFocus.gameObject.SetActive(true);
|
|
m_CurrentAddFocusState = rss.rss;
|
|
AddFocus.isOn = (rss.rss == 1);
|
|
}
|
|
|
|
public void BossFocus(RetBossHomeSetBossRss rss)
|
|
{
|
|
for(int i=0;i<m_ShowBossList.Count;i++)
|
|
{
|
|
if (m_ShowBossList[i].FubenID == rss.fubenid && m_ShowBossList[i].BossID == rss.bossid)
|
|
{
|
|
if(rss.rss == 1)
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("{#49143}"));
|
|
m_CurrentAddFocusState = rss.rss;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void FocusState(bool isOn)
|
|
{
|
|
if (m_CurrentSelect == null || (m_CurrentAddFocusState==1)==isOn)
|
|
return;
|
|
ReqBossHomeSetBossRss cmd = new ReqBossHomeSetBossRss();
|
|
cmd.bossid = m_CurrentSelect.BossID;
|
|
cmd.fubenid = m_CurrentSelect.FubenID;
|
|
cmd.rss = (isOn ? 1 : 0);
|
|
cmd.SendMsg();
|
|
}
|
|
|
|
public void CloseHistoryTip()
|
|
{
|
|
HistorKillTip.SetActive(false);
|
|
}
|
|
|
|
public void HomeBossInfo(AckBossHomeUserInfo userBoss)
|
|
{
|
|
m_WorldBookRewardTimesAndMax = string.Format("{0}", userBoss.worldbosshandbookawardtimesmax - userBoss.worldbosshandbookawardtimes);
|
|
m_WorldJoinRewardTimesAndMax = string.Format("{0}", userBoss.worldbosskillawardtimesmax - userBoss.worldbosskillawardtimes);
|
|
m_WorldLastKillRewardTimesAndMax = string.Format("{0}", userBoss.worldbosslastkillawardtimesmax - userBoss.worldbosslastkillawardtimes);
|
|
m_HomeBookRewardTimesAndMax = string.Format("{0}", userBoss.bosshomehandbookawardtimesmax - userBoss.bosshomehandbookawardtimes);
|
|
m_HomeWorldJoinRewardTimesAndMax = string.Format("{0}", userBoss.bosshomekillawardtimesmax - userBoss.bosshomekillawardtimes);
|
|
m_HomeWorldLastKillRewardTimesAndMax = string.Format("{0}", userBoss.bosshomelastkillawardtimesmax - userBoss.bosshomelastkillawardtimes);
|
|
UserInfo();
|
|
}
|
|
|
|
public void OnScoreBtn()
|
|
{
|
|
YuanBaoShopLogic.OpenShopForJiFenItem(12, -1);
|
|
}
|
|
|
|
private void AskHomeBossInfo1(int fubenid)
|
|
{
|
|
ReqBossHomeBossState cmd = new ReqBossHomeBossState();
|
|
cmd.fubenid = fubenid;
|
|
cmd.SendMsg();
|
|
}
|
|
|
|
public void HomeBossInfo(AckBossHomeBossState bossState)
|
|
{
|
|
for(int i=0;i<bossState.bossid.Count;i++)
|
|
{
|
|
for(int j=0;j<m_ShowBossList.Count;j++)
|
|
{
|
|
if(m_ShowBossList[j].BossID == bossState.bossid[i])
|
|
{
|
|
m_ShowBossList[j].LeaveBlood = bossState.curhp[i];
|
|
m_ShowBossList[j].isKilled = (bossState.birthtime[i] > 0);
|
|
m_ShowBossList[j].reliveTime = (int)Time.realtimeSinceStartup + bossState.birthtime[i] - GlobalData.ServerAnsiTime;
|
|
}
|
|
}
|
|
}
|
|
m_BossList.RefreshItems();
|
|
if(m_CurrentSelect!=null)
|
|
BossLeaveBlood.text = string.Format("{0}%", m_CurrentSelect.LeaveBlood);
|
|
}
|
|
|
|
public void UserBossInfo()
|
|
{
|
|
UserInfo();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
TagShowPageMain(1);
|
|
}
|
|
|
|
public void ShowPage(int index)
|
|
{
|
|
if (_TagPanel)
|
|
_TagPanel.ShowPage(index);
|
|
}
|
|
|
|
private int m_Page = 0;
|
|
List<BossInfo> m_ShowBossList = new List<BossInfo>();
|
|
public void TagShowPageMain(int page)
|
|
{
|
|
m_Page = page;
|
|
OpenType(page);
|
|
m_ShowBossList.Clear();
|
|
if (page == 0)
|
|
{
|
|
PrivateBossInfo();
|
|
_DescripID = -1;
|
|
}
|
|
else if (page == 1 || page == 2)
|
|
{
|
|
WorldBossInfo(page);
|
|
_DescripID = (page == 1 ? 40 : 60);
|
|
return;
|
|
}
|
|
else if (page == 4)
|
|
{
|
|
ExtraBoss();
|
|
_DescripID = -1;
|
|
}
|
|
else
|
|
{
|
|
_DescripID = 52;
|
|
CrossServerBoss();
|
|
}
|
|
|
|
if (m_ShowBossList.Count <= 0)
|
|
return;
|
|
BossInfo sel = null;
|
|
for (int i=0;i<m_ShowBossList.Count;i++)
|
|
{
|
|
if (m_ShowBossList[i].bossLevel <= GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
if(sel==null)
|
|
{
|
|
sel = m_ShowBossList[i];
|
|
continue;
|
|
}
|
|
|
|
if(sel.ActivityValue < GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.CurStamina &&
|
|
m_ShowBossList[i].ActivityValue >= GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.CurStamina)
|
|
{
|
|
sel = m_ShowBossList[i];
|
|
continue;
|
|
}
|
|
if(sel.bossLevel < m_ShowBossList[i].bossLevel)
|
|
{
|
|
sel = m_ShowBossList[i];
|
|
}
|
|
}
|
|
}
|
|
sel = (sel == null ? m_ShowBossList[0] : sel);
|
|
List<BossInfo> sels = new List<BossInfo>();
|
|
sels.Add(sel);
|
|
m_BossList.InitSelectContent(m_ShowBossList, sels, OnSelectBoss);
|
|
|
|
}
|
|
|
|
List<GameObject> SceneLevelItems = new List<GameObject>();
|
|
private void ShowSceneBoss(object obj)
|
|
{
|
|
string scenelevel = (string)obj;
|
|
string[] strs = scenelevel.Split('_');
|
|
if (strs.Length < 1)
|
|
return;
|
|
int SceneID = -1;
|
|
if (int.TryParse(strs[0], out SceneID) == false)
|
|
return;
|
|
|
|
if (strs[1] == "1" && m_Page == 1)
|
|
{
|
|
Reward1child1.SetActive(false);
|
|
BookRewardTimes.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
Reward1child1.SetActive(true);
|
|
BookRewardTimes.gameObject.SetActive(true);
|
|
}
|
|
|
|
|
|
AskHomeBossInfo1(SceneID);
|
|
BossInfo sel = null;
|
|
List<BossInfo> shows = new List<BossInfo>();
|
|
for (int i = 0; i < m_ShowBossList.Count; i++)
|
|
{
|
|
if (m_ShowBossList[i].SceneID == SceneID)
|
|
{
|
|
if(m_ShowBossList[i].bossLevel <= GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
if (sel == null || sel.bossLevel < m_ShowBossList[i].bossLevel)
|
|
sel = m_ShowBossList[i];
|
|
}
|
|
shows.Add(m_ShowBossList[i]);
|
|
}
|
|
}
|
|
if (shows.Count <= 0)
|
|
return;
|
|
sel = (sel == null ? shows[0] : sel);
|
|
List<BossInfo> sels = new List<BossInfo>();
|
|
sels.Add(sel);
|
|
m_BossList.InitSelectContent(shows, sels, OnSelectBoss);
|
|
}
|
|
|
|
private void WorldBossInfo(int type)
|
|
{
|
|
Dictionary<int, Tab_WorldBoss> bossInfos = TableManager.GetWorldBoss();
|
|
List<string> SceneLevels = new List<string>();
|
|
int lastScene = 0;
|
|
int index = 0;
|
|
string selectLevel = "";
|
|
string lastSceneStr = "";
|
|
foreach (var boss in bossInfos)
|
|
{
|
|
if (boss.Value.Type != type)
|
|
continue;
|
|
Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(boss.Value.Id, 0);
|
|
if (role == null)
|
|
continue;
|
|
BossInfo info = new BossInfo();
|
|
m_ShowBossList.Add(info);
|
|
info.bossName = role.Name;
|
|
info.bossBack = boss.Value.Icon;
|
|
info.BossID = boss.Value.Id;
|
|
info.bossLevel = boss.Value.Level;
|
|
info.bossModelID = role.CharModelID;
|
|
info.bossType = type;
|
|
info.SceneID = boss.Value.SceneID;
|
|
info.FubenID = boss.Value.FubenID;
|
|
info.PosX = boss.Value.PosX;
|
|
info.PosZ = boss.Value.PosZ;
|
|
info.Reward1 = boss.Value.GetRewardShowbyIndex(0);
|
|
info.Reward2 = boss.Value.GetRewardShowbyIndex(1);
|
|
info.bossDesc = boss.Value.BossDesc;
|
|
info.VipFreeEnter = boss.Value.VipLevel;
|
|
info.ConsumType = boss.Value.ConsumeType;
|
|
info.ConsumSubType = boss.Value.ConsumeSubType;
|
|
info.ConsumCount = boss.Value.ConsumeNum;
|
|
info.NoPayTimes = boss.Value.RewardTimes;
|
|
if(boss.Value.SceneID!=lastScene)
|
|
{
|
|
lastScene = boss.Value.SceneID;
|
|
index++;
|
|
string sceneLevel = string.Format("{0}_{1}", boss.Value.SceneID, index);
|
|
if (index == 1 && info.bossType == 1)
|
|
sceneLevel = string.Format("{0}_{1}_true", boss.Value.SceneID, index);
|
|
if (SceneLevels.Contains(sceneLevel) == false)
|
|
SceneLevels.Add(sceneLevel);
|
|
|
|
lastSceneStr = sceneLevel;
|
|
}
|
|
|
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= info.bossLevel)
|
|
{
|
|
selectLevel = lastSceneStr;
|
|
}
|
|
}
|
|
if (SceneLevels.Count <= 0)
|
|
return;
|
|
List<string> sels = new List<string>();
|
|
if (string.IsNullOrEmpty(selectLevel))
|
|
{
|
|
sels.Add(SceneLevels[0]);
|
|
}
|
|
else
|
|
{
|
|
sels.Add(selectLevel);
|
|
}
|
|
m_BossSceneLevels.InitSelectContent(SceneLevels, sels, ShowSceneBoss);
|
|
}
|
|
|
|
private void CrossServerBoss()
|
|
{
|
|
Dictionary<int, Tab_WorldBoss> bossInfos = TableManager.GetWorldBoss();
|
|
List<int> SceneLevels = new List<int>();
|
|
foreach (var boss in bossInfos)
|
|
{
|
|
if (boss.Value.Type != 3)
|
|
continue;
|
|
Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(boss.Value.Id, 0);
|
|
if (role == null)
|
|
continue;
|
|
BossInfo info = new BossInfo();
|
|
m_ShowBossList.Add(info);
|
|
info.bossName = role.Name;
|
|
info.bossBack = boss.Value.Icon;
|
|
info.BossID = boss.Value.Id;
|
|
info.bossLevel = boss.Value.Level;
|
|
info.bossModelID = role.CharModelID;
|
|
info.bossType = 3;
|
|
info.bossDesc = "";
|
|
info.SceneID = boss.Value.SceneID;
|
|
info.FubenID = boss.Value.FubenID;
|
|
info.PosX = boss.Value.PosX;
|
|
info.PosZ = boss.Value.PosZ;
|
|
info.Reward1 = boss.Value.GetRewardShowbyIndex(0);
|
|
info.Reward2 = boss.Value.GetRewardShowbyIndex(1);
|
|
info.VipFreeEnter = boss.Value.VipLevel;
|
|
info.ConsumType = boss.Value.ConsumeType;
|
|
info.ConsumSubType = boss.Value.ConsumeSubType;
|
|
info.ConsumCount = boss.Value.ConsumeNum;
|
|
info.NoPayTimes = boss.Value.RewardTimes;
|
|
}
|
|
if(m_ShowBossList.Count>0)
|
|
{
|
|
AskHomeBossInfo1(m_ShowBossList[0].FubenID);
|
|
}
|
|
}
|
|
|
|
private void PrivateBossInfo()
|
|
{
|
|
Dictionary<int, Tab_PrivateBoss> bossInfos = TableManager.GetPrivateBoss();
|
|
foreach(var boss in bossInfos)
|
|
{
|
|
Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(boss.Value.Id, 0);
|
|
if (role == null)
|
|
continue;
|
|
BossInfo info = new BossInfo();
|
|
m_ShowBossList.Add(info);
|
|
info.bossName = role.Name;
|
|
info.bossBack = boss.Value.Icon;
|
|
info.BossID = boss.Value.Id;
|
|
info.bossLevel = boss.Value.Level;
|
|
info.bossModelID = role.CharModelID;
|
|
info.ActivityValue = boss.Value.ActivityValue;
|
|
info.bossType = 0;
|
|
info.bossDesc = (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= boss.Value.Level ? StrDictionary.GetClientDictionaryString("#{49106}") : string.Format("<color=#ff3131ff>{0}</color>", StrDictionary.GetClientDictionaryString("#{49107}",boss.Value.Level)));
|
|
info.FubenID = boss.Value.FubenID;
|
|
info.SceneID = 0;
|
|
info.Reward1 = boss.Value.GetRewardShowbyIndex(1);
|
|
info.Reward2 = boss.Value.GetRewardShowbyIndex(0);
|
|
info.NoPayTimes = 0;
|
|
}
|
|
}
|
|
|
|
private void ExtraBoss()
|
|
{
|
|
Dictionary<int, Tab_WorldBoss> bossInfos = TableManager.GetWorldBoss();
|
|
List<int> SceneLevels = new List<int>();
|
|
foreach (var boss in bossInfos)
|
|
{
|
|
if (boss.Value.Type != 4)
|
|
continue;
|
|
Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(boss.Value.Id, 0);
|
|
if (role == null)
|
|
continue;
|
|
BossInfo info = new BossInfo();
|
|
m_ShowBossList.Add(info);
|
|
info.bossName = role.Name;
|
|
info.bossBack = boss.Value.Icon;
|
|
info.BossID = boss.Value.Id;
|
|
info.bossLevel = boss.Value.Level;
|
|
info.bossModelID = role.CharModelID;
|
|
info.bossType = 3;
|
|
info.bossDesc = "";
|
|
info.SceneID = boss.Value.SceneID;
|
|
info.FubenID = boss.Value.FubenID;
|
|
info.PosX = boss.Value.PosX;
|
|
info.PosZ = boss.Value.PosZ;
|
|
info.Reward1 = boss.Value.GetRewardShowbyIndex(0);
|
|
info.Reward2 = boss.Value.GetRewardShowbyIndex(1);
|
|
info.VipFreeEnter = boss.Value.VipLevel;
|
|
info.ConsumType = boss.Value.ConsumeType;
|
|
info.ConsumSubType = boss.Value.ConsumeSubType;
|
|
info.ConsumCount = boss.Value.ConsumeNum;
|
|
info.NoPayTimes = boss.Value.RewardTimes;
|
|
}
|
|
//if (m_ShowBossList.Count > 0)
|
|
//{
|
|
// AskHomeBossInfo1(m_ShowBossList[0].FubenID);
|
|
//}
|
|
}
|
|
|
|
private void OpenType(int type)
|
|
{
|
|
BossLeaveBlood.transform.parent.gameObject.SetActive(type != 0);
|
|
Reward1child1.SetActive(type != 0);
|
|
DescriptBtn1.SetActive(type == 3);
|
|
DescriptBtn.SetActive(type == 1 || type == 2 || type == 4);
|
|
HistorKillerObj.SetActive(type == 1 || type == 2 || type == 4);
|
|
ScoreBtnObj.SetActive(type == 1 || type == 2 || type == 4);
|
|
HistorKillTip.SetActive(false);
|
|
AddFocus.gameObject.SetActive(type == 1 || type == 2);
|
|
m_BossSceneLevels.gameObject.SetActive(type == 1 || type == 2 || type == 4);
|
|
Desc.gameObject.SetActive(type == 0 || type == 3);
|
|
Desc2.gameObject.SetActive(type == 2);
|
|
ActivtyValue.gameObject.SetActive(type == 0);
|
|
VipFree.gameObject.SetActive(type == 0);
|
|
BookRewardTimes.gameObject.SetActive(type == 1 || type == 2 || type == 4);
|
|
JoinRewardTimes.gameObject.SetActive(type == 1 || type == 2 || type == 4);
|
|
LastKillRewardTimes.gameObject.SetActive(type == 1 || type == 2 || type == 4);
|
|
m_BossListRect.sizeDelta = new Vector2(220, (type == 0 || type == 3) ? 540 : 480);
|
|
}
|
|
|
|
public void UserInfo()
|
|
{
|
|
if (m_CurrentSelect == null)
|
|
return;
|
|
if (m_CurrentSelect!=null)
|
|
ActivtyValue.text = string.Format("(<color=#a90702ff>{0}</color>)", StrDictionary.GetClientDictionaryString("#{49102}", string.Format("{0}/{1}", GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.CurStamina, m_CurrentSelect.ActivityValue)));
|
|
VipFree.text = string.Format("(<color=#a90702ff>{0}</color>)", StrDictionary.GetClientDictionaryString("#{49103}", WorldBossData.Instance.VipFreeLeaveTimes < 0 ? 0 : WorldBossData.Instance.VipFreeLeaveTimes));
|
|
BookRewardTimes.text = StrDictionary.GetClientDictionaryString("#{49104}", string.Format("<color=#ff0000ff>{0}</color>", m_CurrentSelect.bossType == 1 ? m_WorldBookRewardTimesAndMax : m_HomeBookRewardTimesAndMax));
|
|
JoinRewardTimes.text = StrDictionary.GetClientDictionaryString("#{49135}", string.Format("<color=#ff0000ff>{0}</color>", m_CurrentSelect.bossType == 1 ? m_WorldJoinRewardTimesAndMax : m_HomeWorldJoinRewardTimesAndMax));
|
|
LastKillRewardTimes.text = StrDictionary.GetClientDictionaryString("#{49105}", string.Format("<color=#ff0000ff>{0}</color>", m_CurrentSelect.bossType == 1 ? m_WorldLastKillRewardTimesAndMax : m_HomeWorldLastKillRewardTimesAndMax));
|
|
}
|
|
|
|
private BossInfo m_CurrentSelect;
|
|
public void OnSelectBoss(object initInfo)
|
|
{
|
|
m_CurrentSelect = (BossInfo)initInfo;
|
|
|
|
BossLeaveBlood.text = string.Format("{0}%", m_CurrentSelect.LeaveBlood);
|
|
|
|
if(m_CurrentSelect.bossType == 0)
|
|
{
|
|
Desc.text = StrDictionary.GetClientDictionaryString("#{49100}");
|
|
}
|
|
if (m_CurrentSelect.bossType == 3)
|
|
{
|
|
Desc.text = StrDictionary.GetClientDictionaryString("#{49149}");
|
|
}
|
|
|
|
UserInfo();
|
|
AwardDesc.SetActive(m_CurrentSelect.NoPayTimes == 0);
|
|
NoPay.SetActive(m_CurrentSelect.NoPayTimes == 1);
|
|
m_BossModel.gameObject.SetActive(false);
|
|
Tab_CharModel charModel = TableManager.GetCharModelByID(m_CurrentSelect.bossModelID, 0);
|
|
if (charModel != null)
|
|
{
|
|
m_BossModel.gameObject.SetActive(true);
|
|
m_BossModel.InitModelPath("", charModel, LoadAssetBundle.BUNDLE_PATH_MODEL, true);
|
|
}
|
|
|
|
if (m_CurrentSelect.bossType != 0)
|
|
{
|
|
m_MaskRect.sizeDelta = Vector2.zero;
|
|
m_WorldBossReward.SetActive(true);
|
|
BossLeaveBlood.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
|
|
InitJoinReward(m_CurrentSelect.Reward1, Reward1Obj, BackRewards);
|
|
InitJoinReward(m_CurrentSelect.Reward2, Reward2Obj, JoinRewards);
|
|
|
|
JoinBtnText.text = (m_CurrentSelect.VipFreeEnter > 0 ? StrDictionary.GetClientDictionaryString("#{49141}", m_CurrentSelect.VipFreeEnter) : StrDictionary.GetClientDictionaryString("#{49142}"));
|
|
|
|
AddFocus.gameObject.SetActive(false);
|
|
if(m_CurrentSelect.bossType == 1 || m_CurrentSelect.bossType == 2)
|
|
{
|
|
ReqBossHomeBossRssState cmd = new ReqBossHomeBossRssState();
|
|
cmd.bossid = m_CurrentSelect.BossID;
|
|
cmd.fubenid = m_CurrentSelect.FubenID;
|
|
cmd.SendMsg();
|
|
}
|
|
}
|
|
|
|
List<GameObject> JoinRewards = new List<GameObject>();
|
|
List<GameObject> BackRewards = new List<GameObject>();
|
|
|
|
public void InitJoinReward(string items, GameObject cloneObj, List<GameObject> objs)
|
|
{
|
|
for (int i = 0; i < objs.Count; i++)
|
|
{
|
|
objs[i].SetActive(false);
|
|
}
|
|
string[] itemIds = items.Split('|');
|
|
for (int i = 0; i < itemIds.Length; i++)
|
|
{
|
|
int itemID = -1;
|
|
if (int.TryParse(itemIds[i], out itemID))
|
|
{
|
|
if (objs.Count > i)
|
|
{
|
|
CloneRewardItem(itemID, objs[i], cloneObj);
|
|
continue;
|
|
}
|
|
GameObject newObj = CloneRewardItem(itemID, null, cloneObj);
|
|
if (newObj != null)
|
|
objs.Add(newObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
public GameObject CloneRewardItem(int itemId, GameObject oldItemObj, GameObject cloneObj)
|
|
{
|
|
if (oldItemObj == null && cloneObj == null)
|
|
return null;
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(itemId, 0);
|
|
if (commonItem == null)
|
|
return null;
|
|
if (oldItemObj == null)
|
|
{
|
|
oldItemObj = GameObject.Instantiate(cloneObj);
|
|
oldItemObj.transform.SetParent(cloneObj.transform.parent);
|
|
oldItemObj.transform.localPosition = Vector3.zero;
|
|
oldItemObj.transform.localScale = cloneObj.transform.localScale;
|
|
}
|
|
if (oldItemObj == null)
|
|
return null;
|
|
oldItemObj.SetActive(true);
|
|
Button btn = oldItemObj.GetComponentInChildren<Button>();
|
|
if (btn != null)
|
|
{
|
|
btn.onClick.RemoveAllListeners();
|
|
btn.onClick.AddListener(delegate ()
|
|
{
|
|
ItemTooltipsLogic.ShowItemTooltip(itemId, ItemTooltipsLogic.ShowType.Info, btn.transform.position);
|
|
});
|
|
}
|
|
Image[] imgs = oldItemObj.GetComponentsInChildren<Image>();
|
|
for (int i = 0; i < imgs.Length; i++)
|
|
{
|
|
if (imgs[i] != null && imgs[i].name == "Quility")
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(imgs[i], Utils.GetItemQualityFrame(commonItem));
|
|
}
|
|
if (imgs[i] != null && imgs[i].name == "Icon")
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(imgs[i], commonItem.Icon);
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, imgs[i].transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, imgs[i].transform);
|
|
}
|
|
}
|
|
}
|
|
return oldItemObj;
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
UIManager.CloseUI(UIInfo.Boss);
|
|
}
|
|
|
|
public void OpenBossBookUI()
|
|
{
|
|
UIManager.ShowUI(UIInfo.MeridiaSoulWnd, delegate (bool bSuccess, object param)
|
|
{
|
|
if (bSuccess)
|
|
{
|
|
MeridiaSoulMain.Instance._TagPanel.ShowPage((int)param);
|
|
}
|
|
},
|
|
3);
|
|
}
|
|
|
|
public void JoinKill_Boss()
|
|
{
|
|
if (m_CurrentSelect == null)
|
|
return;
|
|
|
|
if(GameManager.gameManager.RunningScene == m_CurrentSelect.SceneID || GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterCopySceneID == m_CurrentSelect.FubenID)
|
|
{
|
|
FightBoss();
|
|
return;
|
|
}
|
|
|
|
Tab_Fuben fuben = TableManager.GetFubenByID(m_CurrentSelect.FubenID, 0);
|
|
if (fuben == null)
|
|
return;
|
|
if(fuben.PlayerLevelMin > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{9010}", fuben.PlayerLevelMin,fuben.Name));
|
|
return;
|
|
}
|
|
|
|
if (m_CurrentSelect.FubenID > 0 && m_CurrentSelect.bossType == 0)
|
|
{
|
|
if (WorldBossData.Instance.VipFreeLeaveTimes <= 0 && GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.CurStamina < m_CurrentSelect.ActivityValue)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{49120}"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
//如果是跨服BOSS需要判断活动有没有开启
|
|
if (m_CurrentSelect.bossType == 3 && ActivityDataManager.Instance.IsActivityState((int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_CROSSSERVERBOSS,ActivityDataManager.ActivityState.Playing) == false)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{81000}"));
|
|
return;
|
|
}
|
|
|
|
if (m_CurrentSelect.VipFreeEnter > 0 && WorldBossData.Instance.VipCanUseLevel < m_CurrentSelect.VipFreeEnter)
|
|
{
|
|
string ConsumName = "";
|
|
if(m_CurrentSelect.ConsumType == (int)CONSUM_TYPE.ITEM)
|
|
{
|
|
Tab_CommonItem comItem = TableManager.GetCommonItemByID(m_CurrentSelect.ConsumSubType, 0);
|
|
if (comItem != null)
|
|
ConsumName = comItem.Name;
|
|
}
|
|
if (m_CurrentSelect.ConsumType == (int)CONSUM_TYPE.MONEY)
|
|
{
|
|
ConsumName = Utils.GetMoneyName(m_CurrentSelect.ConsumSubType);
|
|
}
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{49140}", ConsumName + m_CurrentSelect.ConsumCount.ToString()), "", delegate ()
|
|
{
|
|
if (JudgeMoneyLogic.IsMoneyEnough((MONEYTYPE)m_CurrentSelect.ConsumSubType, m_CurrentSelect.ConsumCount))
|
|
{
|
|
FightBoss();
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
FightBoss();
|
|
}
|
|
|
|
private void FightBoss()
|
|
{
|
|
if (m_CurrentSelect == null)
|
|
return;
|
|
if (m_CurrentSelect.FubenID > 0 && m_CurrentSelect.bossType == 0 && GCGame.Utils.EnterCopy(m_CurrentSelect.FubenID))
|
|
Close();
|
|
else if (m_CurrentSelect.SceneID > 0)
|
|
{
|
|
AutoSearchPoint point = new AutoSearchPoint(m_CurrentSelect.SceneID, m_CurrentSelect.PosX, m_CurrentSelect.PosZ, -1, AutoSearchPoint.ChangeMap_Type.WORLDMAP);
|
|
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
|
|
{
|
|
GameManager.gameManager.AutoSearch.BuildPath(point);
|
|
GameManager.gameManager.AutoSearch.Path.autoSearchRadius = 1.5f;
|
|
GameManager.gameManager.AutoSearch.Path.AutoSearchTargetName = m_CurrentSelect.bossName;
|
|
}
|
|
if (GameManager.gameManager.AutoSearch.IsAutoSearching)
|
|
Close();
|
|
}
|
|
}
|
|
|
|
private int _DescripID = -1;
|
|
public void OpenDescrip()
|
|
{
|
|
MessageHelpLogic.ShowHelpMessage(_DescripID);
|
|
}
|
|
} |