Files
JJBB/Assets/Project/Script/LuaScripts/UI/OpenServiceCS/PromoteWayItem.cs
2024-08-23 15:49:34 +08:00

246 lines
7.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GCGame.Table;
using Module.Log;
using System;
// 提升途径
public class PromoteWayItem : UIItemSelect {
public Image icon;
public Text desc;
private int promoteType;
private string promoteInfo;
public override void Show(Hashtable hash)
{
string info = (string)hash["InitObj"];
info = info.Trim(' ', '\'', '"');
string[] infos = info.Split(';');
string iconSprite = infos[0];
string iconDesc = infos[1];
promoteType = Convert.ToInt32(infos[2]);
promoteInfo = infos[3];
LoadAssetBundle.Instance.SetImageSprite(icon, iconSprite);
desc.text = iconDesc;
}
public override void OnItemClick()
{
base.OnItemClick();
//GotoPromote(promoteType, promoteInfo);
ChatLinkCallFunc.CallStaticFunc(promoteType);
}
private void GotoPromote(int promoteType, string info)
{
switch (promoteType)
{
case 0:
GetMission(info);
break;
case 1:
OpenActivity(info);
break;
case 2:
OpenCopyPanel(info);
break;
case 3:
OpenEnhance(info);
break;
case 4:
OpenPet(info);
break;
case 5:
OpenMarketAct(info);
break;
case 6:
OpenYBShop(info);
break;
case 7:
GoPlayShop(info);
break;
}
OpenServiceRankRootCS.Instance.Close();
}
// 传入 ActivityBase 的ID
private void GetMission(string activityIDStr)
{
int activityID = Convert.ToInt32(activityIDStr.Trim());
ActivityController.ClickActive(activityID);
}
private void OpenActivity(string actTypeStr)
{
int actType = Convert.ToInt32(actTypeStr.Trim());
ActivityController.Show((ActivityController.Acticity_Type)actType);
}
private void OpenCopyPanel(string info)
{
ItemGetPathPopRoot.ShowUI(info.Trim());
}
private void OpenEnhance(string subClassIdStr)
{
int subClassId = Convert.ToInt32(subClassIdStr.Trim());
UIManager.ShowUI(UIInfo.EquipEnhance, delegate (bool bSucess, object param)
{
if (bSucess)
{
switch (subClassId)
{
case 1:
EquipEnhanceRoot.Instance().TryOpen(1);
break;
case 2:
EquipEnhanceRoot.Instance().TryOpen(0);
break;
case 3:
EquipEnhanceRoot.Instance().TryOpen(0);
EquipEnhanceXilian.Instance()._TagPanel.ShowPage(1); //基础洗练
break;
case 4:
EquipEnhanceRoot.Instance().TryOpen(0);
EquipEnhanceXilian.Instance()._TagPanel.ShowPage(2); //词条置换
break;
case 5:
EquipEnhanceRoot.Instance().TryOpen(2); //宝石镶嵌
break;
case 10:
EquipEnhanceRoot.Instance().TryOpen(3);
break;
}
}
});
}
private void OpenPet(string subClassIdStr)
{
int subClassId = Convert.ToInt32(subClassIdStr.Trim());
UIManager.ShowUI(UIInfo.PetMainWndPath,
(bool bSucess, object param) =>
{
if (bSucess)
{
switch (subClassId)
{
//0属性 1洗练 2技能 3修悟
case 1:
{
//打开宠物的属性面板 经验
//PetMainWnd.Instance._TagPanel.ShowPage(0);
PetMainWnd.Instance.ShowPage(0, 0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddExpItem(); //宠物经验道具
}
break;
case 2:
{
//打开宠物的属性面板 寿命
//PetMainWnd.Instance._TagPanel.ShowPage(0);
PetMainWnd.Instance.ShowPage(0, 0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddLiftItem(); //宠物寿命道具
}
break;
case 3:
{
//技能面板
//PetMainWnd.Instance._TagPanel.ShowPage(2);
PetMainWnd.Instance.ShowPage(2, 0);
}
break;
case 4:
case 5:
{
//PetMainWnd.Instance._TagPanel.ShowPage(3);
PetMainWnd.Instance.ShowPage(3, 0);
}
break;
case 6:
{
//PetMainWnd.Instance._TagPanel.ShowPage(1);
//PetMainWnd.Instance.TagShowPageMain(1);
PetMainWnd.Instance.ShowPage(1, 0);
}
break;
case 7:
{
PetMainWnd.Instance.ShowPage(0, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
}
break;
}
}
});
}
private void OpenMarketAct(string info)
{
int enhanceID = -1;
int actID = -1;
int tagIndex = -1;
string[] infos = info.Trim().Split('*');
if(infos.Length > 0)
{
enhanceID = Convert.ToInt32(infos[0]);
}
if(infos.Length > 1)
{
actID = Convert.ToInt32(infos[1]);
}
if (infos.Length > 2)
{
tagIndex = Convert.ToInt32(infos[2]);
}
if(tagIndex != -1)
{
OpenServiceRootCS.OpenWithTagIndex = tagIndex;
}
ItemGetPathPopRoot.GotoOperationalAct(enhanceID, actID);
}
// 跳转元宝商店,仅限元宝,灵玉,积分
private void OpenYBShop(string info)
{
string[] infos = info.Trim(' ', '"').Split('*');
string moneyTypeStr = "";
string pageClass = "";
if (infos.Length > 0)
{
moneyTypeStr = infos[0];
}
if(infos.Length > 1)
{
pageClass = infos[1];
}
YuanBaoShopLogic.OpenShopPageStr(moneyTypeStr, pageClass);
}
private void GoPlayShop(string info)
{
string[] infos = info.Trim(' ', '"').Split('*');
if(infos.Length == 2)
{
int classType = Convert.ToInt32(infos[0]);
int subClassType = Convert.ToInt32(infos[1]);
Market.ShowSysMarket(classType, subClassType);
//Market.ShowPlayerShopMarket(classType, subClassType);
}
else
{
LogModule.ErrorLog("Error: wrong param" + info);
}
}
}