595 lines
20 KiB
C#
595 lines
20 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.TitleInvestitive;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
public class TitleNameViewCtr : MonoBehaviour {
|
|||
|
|
|||
|
public static TitleNameViewCtr Instace;
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Instace = this;
|
|||
|
}
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Instace = null;
|
|||
|
}
|
|||
|
|
|||
|
#region UI拖拽控件
|
|||
|
public GameObject _TotalPropPanel; //属性总览界面
|
|||
|
public GameObject _DescPanel; //称号描述界面
|
|||
|
|
|||
|
public GameObject res_menuItem; //菜单按钮Prefab
|
|||
|
public GameObject res_titleNameItem; //子Item按钮
|
|||
|
public Transform prefabParent;
|
|||
|
|
|||
|
public ToggleGroup menuItemToggleGroup;
|
|||
|
|
|||
|
public GameObject titleNameGO;
|
|||
|
public Text titleNameText;
|
|||
|
public Image titleNameImage;
|
|||
|
private GameObject titleEffect;
|
|||
|
public Text titleNameDescText;
|
|||
|
|
|||
|
public Text titlePropDescText;
|
|||
|
public Text gainWayDescText;
|
|||
|
|
|||
|
public Button activiteActBtn;
|
|||
|
public Button activiteCancelBtn;
|
|||
|
public Button adornActBtn;
|
|||
|
public Button adornCancelBtn;
|
|||
|
|
|||
|
|
|||
|
//称号标记
|
|||
|
public Text markDesc;
|
|||
|
public Text limitDesc;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 称号激活数量
|
|||
|
/// </summary>
|
|||
|
public int TitleNumber;
|
|||
|
public int jiehun;
|
|||
|
public int jiebai;
|
|||
|
public int teshu;
|
|||
|
public int paihang;
|
|||
|
public int zhanchan;
|
|||
|
public int keju;
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
public List<GameSystemTitleInvestitive> m_AllOwnTileNameList = new List<GameSystemTitleInvestitive>();
|
|||
|
private Dictionary<int, Toggle> menuToggleDic = new Dictionary<int, Toggle>();//菜单开关
|
|||
|
private Dictionary<int, List<Toggle>> subItemToggleDic = new Dictionary<int, List<Toggle>>();
|
|||
|
/// <summary>
|
|||
|
/// 当前选择的ID
|
|||
|
/// </summary>
|
|||
|
public int CurSelectedClassId = -1;
|
|||
|
[HideInInspector]
|
|||
|
public bool hasOpenUI = false;
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
AddTypeToList();
|
|||
|
|
|||
|
}
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (Input.GetKeyDown(KeyCode.P))
|
|||
|
{
|
|||
|
for (int i = 0; i < m_AllOwnTileNameList.Count; i++)
|
|||
|
{
|
|||
|
var aaa = m_AllOwnTileNameList.Count;
|
|||
|
Debug.LogError(aaa);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
AskForAllOwnTileNameList(); //请求已经拥有的全部称谓List
|
|||
|
}
|
|||
|
|
|||
|
void RefreshTitleNameState()
|
|||
|
{
|
|||
|
for (int index = 0; index < subItemList.Count; index++)
|
|||
|
{
|
|||
|
subItemList[index].GetComponent<TitleNameItem>().RefreshTitleState(IsOwnTitle(subItemList[index].GetComponent<TitleNameItem>().titleId));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ShowDefaultFirst()
|
|||
|
{
|
|||
|
//OnMenuItemClick(1); //选择第一个大菜单
|
|||
|
menuToggleDic.First().Value.isOn = true; //第一个Menu设置为选中状态
|
|||
|
//subItemToggleDic.First().Value[0].isOn = true; //第一个Menu的子Item设置为选中状态
|
|||
|
//OnSubItemClick(subItemToggleDic.First().Value[0].GetComponentInParent<TitleNameItem>().titleId);
|
|||
|
//curSelectedTileNameId = subItemToggleDic.First().Value[0].GetComponentInParent<TitleNameItem>().titleId;
|
|||
|
ShowMarkIcon();
|
|||
|
}
|
|||
|
|
|||
|
private void OnDisable()
|
|||
|
{
|
|||
|
hasOpenUI = false;
|
|||
|
}
|
|||
|
|
|||
|
List<CG_ACTIVE_TITLE> allTitleList = new List<CG_ACTIVE_TITLE>();
|
|||
|
|
|||
|
//所有称号
|
|||
|
void AskForAllOwnTileNameList()
|
|||
|
{
|
|||
|
CG_ACTIVE_TITLE ask = (CG_ACTIVE_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_TITLE);
|
|||
|
ask.SetOptionType(4);
|
|||
|
ask.SetTitleId(0);
|
|||
|
ask.SendPacket();
|
|||
|
|
|||
|
TitleNumber++;
|
|||
|
}
|
|||
|
//所有标题
|
|||
|
public void GetAllTitleNameList()
|
|||
|
{
|
|||
|
m_AllOwnTileNameList = GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList;
|
|||
|
RefreshTitleNameState();
|
|||
|
ShowMarkIcon();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 大菜單名字信息
|
|||
|
/// </summary>
|
|||
|
public Dictionary<int, string> menutItemTypeAndNameDic = new Dictionary<int, string>();
|
|||
|
void AddAllTitleDataToList()
|
|||
|
{
|
|||
|
menutItemTypeAndNameDic = new Dictionary<int, string>();
|
|||
|
menutItemTypeAndNameDic.Add(0, StrDictionary.GetClientDictionaryString("#{1977}"));//特殊类型(总览)
|
|||
|
foreach (var title in TableManager.GetTitleData().Values)
|
|||
|
{
|
|||
|
if(!menutItemTypeAndNameDic.ContainsKey(title.TitileClass))
|
|||
|
{
|
|||
|
menutItemTypeAndNameDic.Add(title.TitileClass, title.TitleName);
|
|||
|
Debug.LogError(title.TitleName+ " 菜單名字");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void AddTypeToList()
|
|||
|
{
|
|||
|
AddAllTitleDataToList(); //读取全部的配置
|
|||
|
|
|||
|
//根据大类创建子item
|
|||
|
foreach(var title in menutItemTypeAndNameDic)
|
|||
|
{
|
|||
|
PushMenuItem(title.Key);
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 清空
|
|||
|
/// </summary>
|
|||
|
public void ClearAllPrefab()
|
|||
|
{
|
|||
|
for (int index = 0; index < menuItemList.Count; index++)
|
|||
|
{
|
|||
|
GameObject.Destroy(menuItemList[index].gameObject);
|
|||
|
}
|
|||
|
for(int index = 0; index < subItemList.Count; index++)
|
|||
|
{
|
|||
|
GameObject.Destroy(subItemList[index].gameObject);
|
|||
|
}
|
|||
|
|
|||
|
menuItemList.Clear();
|
|||
|
subItemList.Clear();
|
|||
|
}
|
|||
|
|
|||
|
private List<GameObject> menuItemList = new List<GameObject>();
|
|||
|
private List<GameObject> subItemList = new List<GameObject>();
|
|||
|
/// <summary>
|
|||
|
/// 子类列表
|
|||
|
/// key所属菜单
|
|||
|
/// </summary>
|
|||
|
private Dictionary<int, List<GameObject>> subItemObjList = new Dictionary<int, List<GameObject>>();
|
|||
|
void PushMenuItem(int type)
|
|||
|
{
|
|||
|
GameObject menuItemPrefab = GameObject.Instantiate(res_menuItem);//初始化菜单按钮
|
|||
|
|
|||
|
//设置缩放比位置
|
|||
|
menuItemPrefab.transform.SetParent(prefabParent);
|
|||
|
menuItemPrefab.transform.localPosition = Vector3.zero;
|
|||
|
menuItemPrefab.transform.localScale = Vector3.one;
|
|||
|
menuItemPrefab.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|||
|
|
|||
|
menuItemList.Add(menuItemPrefab);
|
|||
|
int CurTypeClassId = type;//菜单类型
|
|||
|
menuItemPrefab.GetComponent<TitleMenuItem>().InitMenuItem(type, GetTypeName(type));//获取菜单名
|
|||
|
|
|||
|
//设置Toggle父节点
|
|||
|
menuItemPrefab.GetComponentInChildren<Toggle> ().group = menuItemToggleGroup; //实现点击高亮
|
|||
|
menuItemPrefab.AddComponent<ToggleGroup>(); //添加ToggleGroup组件
|
|||
|
|
|||
|
var subItemToggleGroup = menuItemPrefab.GetComponent<ToggleGroup>();
|
|||
|
|
|||
|
//控制选中状态
|
|||
|
if(menuToggleDic.ContainsKey(CurTypeClassId))
|
|||
|
{
|
|||
|
menuToggleDic[CurTypeClassId] = menuItemPrefab.GetComponentInChildren< Toggle > ();
|
|||
|
}else
|
|||
|
{
|
|||
|
menuToggleDic.Add(CurTypeClassId, menuItemPrefab.GetComponentInChildren<Toggle>());
|
|||
|
}
|
|||
|
|
|||
|
//创建子Item
|
|||
|
foreach (var titleInfo in TableManager.GetTitleData().Values)
|
|||
|
{
|
|||
|
if (titleInfo.TitileClass == CurTypeClassId) //属于此Class的子类(共22个子类)
|
|||
|
{
|
|||
|
GameObject subItemPrefab = GameObject.Instantiate(res_titleNameItem);//初始化属于该菜单的子类菜单
|
|||
|
|
|||
|
//设置缩放比
|
|||
|
subItemPrefab.transform.SetParent(prefabParent);
|
|||
|
subItemPrefab.transform.localPosition = Vector3.zero;
|
|||
|
subItemPrefab.transform.localScale = Vector3.one;
|
|||
|
subItemPrefab.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|||
|
|
|||
|
subItemList.Add(subItemPrefab);
|
|||
|
//设置子item的ToggleGroup
|
|||
|
subItemPrefab.GetComponentInChildren<Toggle>().group = subItemToggleGroup;
|
|||
|
|
|||
|
//初始化信息(子类信息)
|
|||
|
subItemPrefab.GetComponent<TitleNameItem>().InitTitleNmaeItem(titleInfo.Name, CurTypeClassId, titleInfo.Id, IsOwnTitle(titleInfo.Id));
|
|||
|
//按类型存起来(所有子类)
|
|||
|
if(subItemObjList.ContainsKey(CurTypeClassId))
|
|||
|
{
|
|||
|
subItemObjList[CurTypeClassId].Add(subItemPrefab);
|
|||
|
}else
|
|||
|
{
|
|||
|
List<GameObject> objList = new List<GameObject>();
|
|||
|
objList.Add(subItemPrefab);
|
|||
|
subItemObjList.Add(CurTypeClassId, objList);
|
|||
|
}
|
|||
|
#region 临时
|
|||
|
if (titleInfo.TitileClass == 8)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (titleInfo.TitileClass == 10)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (titleInfo.TitileClass == 5)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (titleInfo.TitileClass == 4)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (titleInfo.TitileClass == 2)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (titleInfo.TitileClass == 7)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
//隐藏所有子类
|
|||
|
subItemPrefab.gameObject.SetActive(false);
|
|||
|
if(subItemToggleDic.ContainsKey(CurTypeClassId))
|
|||
|
{
|
|||
|
subItemToggleDic[CurTypeClassId].Add(subItemPrefab.GetComponentInChildren<Toggle>());
|
|||
|
}else
|
|||
|
{
|
|||
|
List<Toggle> subList = new List<Toggle>();
|
|||
|
subList.Add(subItemPrefab.GetComponentInChildren<Toggle>());
|
|||
|
subItemToggleDic.Add(CurTypeClassId, subList);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
ShowDefaultFirst();
|
|||
|
}
|
|||
|
|
|||
|
public void ClearSubItemList()
|
|||
|
{
|
|||
|
for(int index = 0; index < subItemList.Count; index++)
|
|||
|
{
|
|||
|
GameObject.Destroy(subItemList[index].gameObject);
|
|||
|
}
|
|||
|
subItemList.Clear();
|
|||
|
}
|
|||
|
|
|||
|
//后期添加类型或者修改表的话只用在这里添加对应的大类型
|
|||
|
string GetTypeName(int type)
|
|||
|
{
|
|||
|
if(menutItemTypeAndNameDic.ContainsKey(type))
|
|||
|
{
|
|||
|
return menutItemTypeAndNameDic[type];
|
|||
|
}else
|
|||
|
{
|
|||
|
return "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int curSelectedTileNameId = -1; //当前佩戴的称谓ID
|
|||
|
/// <summary>
|
|||
|
/// 点击菜单
|
|||
|
/// </summary>
|
|||
|
/// <param name="classId"></param>
|
|||
|
public void OnMenuItemClick(int classId)
|
|||
|
{
|
|||
|
if(classId == 0)
|
|||
|
{
|
|||
|
_TotalPropPanel.gameObject.SetActive(true);
|
|||
|
_DescPanel.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
_TotalPropPanel.gameObject.SetActive(false);
|
|||
|
_DescPanel.SetActive(true);
|
|||
|
|
|||
|
if (CurSelectedClassId == classId) //关闭
|
|||
|
{
|
|||
|
classId = -1;
|
|||
|
foreach (var subitemList in subItemObjList)
|
|||
|
{
|
|||
|
if (subitemList.Key == classId) //需要显示
|
|||
|
{
|
|||
|
for (int index = 0; index < subitemList.Value.Count; index++)
|
|||
|
{
|
|||
|
subitemList.Value[index].SetActive(true);
|
|||
|
subitemList.Value[index].GetComponent<TitleNameItem>().RefreshSubItemState();
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
for (int index = 0; index < subitemList.Value.Count; index++)
|
|||
|
{
|
|||
|
subitemList.Value[index].SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
CurSelectedClassId = classId;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
foreach (var subitemList in subItemObjList)
|
|||
|
{
|
|||
|
if (subitemList.Key == classId) //需要显示
|
|||
|
{
|
|||
|
for (int index = 0; index < subitemList.Value.Count; index++)
|
|||
|
{
|
|||
|
subitemList.Value[index].SetActive(true);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
for (int index = 0; index < subitemList.Value.Count; index++)
|
|||
|
{
|
|||
|
subitemList.Value[index].SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (subItemToggleDic.ContainsKey(classId))
|
|||
|
{
|
|||
|
subItemToggleDic[classId][0].isOn = true; //第一个Menu的子Item设置为选中状态
|
|||
|
OnSubItemClick(subItemToggleDic[classId][0].GetComponentInParent<TitleNameItem>().titleId);//获得点击菜单的id
|
|||
|
}
|
|||
|
CurSelectedClassId = classId;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnSubItemClick(int titleId)
|
|||
|
{
|
|||
|
ShowTiltNameDescPanel(titleId);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void ShowTiltNameDescPanel(int titleId)
|
|||
|
{
|
|||
|
curSelectedTileNameId = titleId;
|
|||
|
|
|||
|
Tab_TitleData titleData = TableManager.GetTitleDataByID(titleId, 0);
|
|||
|
if (titleData != null)
|
|||
|
{
|
|||
|
titleNameText.text = titleData.Name;
|
|||
|
titleNameDescText.text = titleData.InvestitiveDescription;
|
|||
|
titlePropDescText.text = titleData.AttrDesc;
|
|||
|
gainWayDescText.text = titleData.GetDesc;
|
|||
|
if (string.IsNullOrEmpty(titleData.NameImage))
|
|||
|
{
|
|||
|
titleNameGO.SetActive(true);
|
|||
|
titleNameImage.gameObject.SetActive(false);
|
|||
|
//if (titleEffect != null)
|
|||
|
//{
|
|||
|
// GameObject.Destroy(titleEffect);
|
|||
|
//}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
titleNameGO.SetActive(false);
|
|||
|
titleNameImage.gameObject.SetActive(true);
|
|||
|
if (titleEffect != null)
|
|||
|
{
|
|||
|
GameObject.DestroyImmediate(titleEffect);
|
|||
|
}
|
|||
|
//LoadAssetBundle.Instance.SetImageSprite(titleNameImage, titleData.NameImage, delegate (bool isSucess, GameObject obj) { titleNameImage.SetNativeSize(); });
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(titleNameImage, titleData.NameImage, delegate (bool isSucess, GameObject obj)
|
|||
|
{
|
|||
|
titleNameImage.SetNativeSize();
|
|||
|
//var effectData = TableManager.GetEffectByID(titleData.EffectId, 0);
|
|||
|
//if (effectData != null)
|
|||
|
// LoadAssetBundle.Instance.LoadGameObject(LoadAssetBundle.BUNDLE_PATH_EFFECT, effectData.Path, (string assetName, GameObject resObj, Hashtable hashParam) =>
|
|||
|
// {
|
|||
|
// if (resObj != null)
|
|||
|
// {
|
|||
|
// titleEffect = GameObject.Instantiate(resObj);
|
|||
|
// titleEffect.transform.SetParent(titleNameImage.gameObject.transform);
|
|||
|
// titleEffect.AddComponent<UIParticleSystem>();
|
|||
|
// titleEffect.transform.localScale = Vector3.one;
|
|||
|
// titleEffect.transform.localPosition = Vector3.zero;
|
|||
|
// titleEffect.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|||
|
// }
|
|||
|
// }, null);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
markDesc.text = (titleData.OwnerTime == -1 ? StrDictionary.GetClientDictionaryString("#{46205}") : StrDictionary.GetClientDictionaryString("#{46206}")); //"永久称号" : "限时称号");
|
|||
|
|
|||
|
//是否拥有当前称号
|
|||
|
if(IsOwnTitle(titleId))
|
|||
|
{
|
|||
|
limitDesc.gameObject.SetActive(titleData.OwnerTime == -1 ? false : true);
|
|||
|
if (limitDesc.gameObject.activeInHierarchy)
|
|||
|
{
|
|||
|
for (int index = 0; index < m_AllOwnTileNameList.Count; index++)
|
|||
|
{
|
|||
|
if (m_AllOwnTileNameList[index].TitleID == titleId)
|
|||
|
{
|
|||
|
if (m_AllOwnTileNameList[index].ValidTime <= 0)
|
|||
|
{
|
|||
|
limitDesc.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
limitDesc.text = GetRemainTimeString(m_AllOwnTileNameList[index].ValidTime);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}else
|
|||
|
{
|
|||
|
limitDesc.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
ShowMarkIcon();
|
|||
|
}
|
|||
|
|
|||
|
public bool IsOwnTitle(int titleId)
|
|||
|
{
|
|||
|
if(GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsGainTitle(titleId))
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
private bool hasAdorned = false;
|
|||
|
private bool hasActived = false;
|
|||
|
|
|||
|
public void ShowMarkIcon()
|
|||
|
{
|
|||
|
//佩戴 取消佩戴
|
|||
|
if(GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsGainTitle(curSelectedTileNameId))
|
|||
|
{
|
|||
|
|
|||
|
if (GameManager.gameManager.PlayerDataPool.TitleInvestitive.GetCurrentTitleID() == curSelectedTileNameId)
|
|||
|
{
|
|||
|
hasAdorned = true;
|
|||
|
adornActBtn.gameObject.SetActive(false);
|
|||
|
adornCancelBtn.gameObject.SetActive(true);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
hasAdorned = false;
|
|||
|
adornActBtn.gameObject.SetActive(true);
|
|||
|
adornCancelBtn.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
adornActBtn.gameObject.SetActive(false);
|
|||
|
adornCancelBtn.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
// 激活 取消激活
|
|||
|
//if (GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsGainTitle(curSelectedTileNameId))
|
|||
|
//{
|
|||
|
// if (GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsTitleActived(curSelectedTileNameId))
|
|||
|
// {
|
|||
|
// hasActived = true;
|
|||
|
// activiteCancelBtn.gameObject.SetActive(true);
|
|||
|
// activiteActBtn.gameObject.SetActive(false);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// hasActived = false;
|
|||
|
// activiteCancelBtn.gameObject.SetActive(false);
|
|||
|
// activiteActBtn.gameObject.SetActive(true);
|
|||
|
// }
|
|||
|
//}
|
|||
|
//else
|
|||
|
{
|
|||
|
activiteCancelBtn.gameObject.SetActive(false);
|
|||
|
activiteActBtn.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
for (int index = 0; index < subItemList.Count; index++)
|
|||
|
{
|
|||
|
if(subItemList[index].gameObject.activeInHierarchy)
|
|||
|
{
|
|||
|
subItemList[index].gameObject.GetComponent<TitleNameItem>().RefreshSubItemState();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnCloseBtnClick()
|
|||
|
{
|
|||
|
if(RoleViewLogic.Instance() && RoleViewLogic.Instance().gameObject.activeInHierarchy)
|
|||
|
{
|
|||
|
if(RoleViewLogic.Instance().curSelectPage == 0)
|
|||
|
{
|
|||
|
RoleViewLogic.Instance().ReqSimpleAttr();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
RoleViewLogic.Instance().ReqDetailAttr();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.TitleView);
|
|||
|
}
|
|||
|
|
|||
|
public void OnActiviteBtnClick()
|
|||
|
{
|
|||
|
if (!hasActived)
|
|||
|
{
|
|||
|
CG_ACTIVE_TITLE ask = (CG_ACTIVE_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_TITLE);
|
|||
|
ask.SetOptionType(2);
|
|||
|
ask.SetTitleId(curSelectedTileNameId);
|
|||
|
ask.SendPacket();
|
|||
|
}else
|
|||
|
{
|
|||
|
CG_ACTIVE_TITLE ask = (CG_ACTIVE_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_TITLE);
|
|||
|
ask.SetOptionType(2);
|
|||
|
ask.SetTitleId(0);
|
|||
|
ask.SendPacket();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnAdornBtnClick()
|
|||
|
{
|
|||
|
if (!hasAdorned)
|
|||
|
{
|
|||
|
CG_ACTIVE_TITLE ask = (CG_ACTIVE_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_TITLE);
|
|||
|
ask.SetOptionType(1);
|
|||
|
ask.SetTitleId(curSelectedTileNameId);
|
|||
|
ask.SendPacket();
|
|||
|
}else
|
|||
|
{
|
|||
|
CG_ACTIVE_TITLE ask = (CG_ACTIVE_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_TITLE);
|
|||
|
ask.SetOptionType(1);
|
|||
|
ask.SetTitleId(0);
|
|||
|
ask.SendPacket();
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public string GetRemainTimeString(int remainTime)
|
|||
|
{
|
|||
|
System.DateTime startTime = new System.DateTime(1970, 1, 1).ToLocalTime();
|
|||
|
DateTime endTime = startTime.AddSeconds(GlobalData.ServerAnsiTime + remainTime);
|
|||
|
return StrDictionary.GetClientDictionaryString("#{46204}", endTime.Year, endTime.Month, endTime.Day, endTime.Hour, endTime.Minute);
|
|||
|
//string.Format("注:有限期至{0}年{1}月{2}日{3}点{4}分", endTime.Year, endTime.Month, endTime.Day, endTime.Hour, endTime.Minute);
|
|||
|
}
|
|||
|
|
|||
|
}
|