Files
JJBB/Assets/Project/Script/GUI/Message/ItemGetPathItem.cs

218 lines
7.6 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Module.Log;
using GCGame.Table;
using System;
// 物品Tip的获取途径Item
public class ItemGetPathItem : UIItemBase {
public Text desc;
public Image typeImg;
public Sprite marketSprite;
public Sprite dailySprite;
public Sprite npcSptrite;
public override void Show(Hashtable hash)
{
ItemGetPathPopRoot.GetPathData info = hash["InitObj"] as ItemGetPathPopRoot.GetPathData;
if(info == null)
{
LogModule.ErrorLog("Wrong info type in ItemGetPathItem.");
return;
}
ShowInfo(info);
}
private void ShowInfo(ItemGetPathPopRoot.GetPathData info)
{
switch(info.pathType)
{
case 2:// NPC
typeImg.sprite = npcSptrite;
typeImg.gameObject.SetActive(true);
break;
case 6:// 日常
typeImg.sprite = dailySprite;
typeImg.gameObject.SetActive(true);
break;
case 9:// 运营活动
typeImg.sprite = marketSprite;
typeImg.gameObject.SetActive(true);
break;
default:
typeImg.gameObject.SetActive(false);
break;
}
int id = -1;
if (info.pathType != 9 && info.pathType != 10)
{
id = string.IsNullOrEmpty(info.info) ? -1 : Convert.ToInt32(info.info);
}
switch (info.pathType)
{
case 0:// 元宝商城
desc.text = StrDictionary.GetClientDictionaryString("#{6714}");
break;
case 1:// 系统商城
{
Tab_SystemShop tab = TableManager.GetSystemShopByID(id, 0);
if (tab != null)
{
desc.gameObject.SetActive(true);
desc.text = tab.Name;
}
else
{
desc.gameObject.SetActive(false);
}
}
break;
case 2:// NPC商店
{
Tab_AutoSearch tab = TableManager.GetAutoSearchByID(id, 0);
if (tab != null)
{
desc.gameObject.SetActive(true);
desc.text = tab.TargetName;
}
else
{
desc.gameObject.SetActive(false);
}
}
break;
case 3:// 怪物掉落
desc.gameObject.SetActive(true);
desc.text = StrDictionary.GetClientDictionaryString("#{6717}");
break;
case 4:// 交易市场
desc.gameObject.SetActive(true);
desc.text = StrDictionary.GetClientDictionaryString("#{6718}");
break;
case 5:// 玩家商店
desc.gameObject.SetActive(true);
desc.text = StrDictionary.GetClientDictionaryString("#{6719}");
break;
case 6:// 活动
{
Tab_ActivityBase tab = TableManager.GetActivityBaseByID(id, 0);
if (tab != null)
{
desc.gameObject.SetActive(true);
desc.text = tab.ActivityName;
}
else
{
desc.gameObject.SetActive(false);
}
}
break;
case 7:// 百晓生
desc.gameObject.SetActive(true);
desc.text = StrDictionary.GetClientDictionaryString("#{6721}");
break;
case 8:// 副本
{
desc.gameObject.SetActive(true);
int fubenID = Convert.ToInt32(info.info) / 10;
switch (fubenID)
{
case 10:
desc.text = StrDictionary.GetClientDictionaryString("#{6772}");
break;
case 11:
desc.text = StrDictionary.GetClientDictionaryString("#{6730}");
break;
case 12:
desc.text = StrDictionary.GetClientDictionaryString("#{6731}");
break;
//case 13:
// desc.text = StrDictionary.GetClientDictionaryString("#{6732}");
// break;
//case 14:
// desc.text = StrDictionary.GetClientDictionaryString("#{6733}");
// break;
case 0:
desc.text = StrDictionary.GetClientDictionaryString("#{6732}");
break;
default:
desc.gameObject.SetActive(false);
break;
}
}
break;
case 9:// 运营活动
{
// 活动特殊处理,必须用‘,区分入口和ID
string[] infos = info.info.Split(';');
if (infos.Length < 2)
{
LogModule.ErrorLog("Config error !!!");
desc.gameObject.SetActive(false);
return;
}
if (infos[0] == "-1")
{
desc.gameObject.SetActive(true);
desc.text = StrDictionary.GetClientDictionaryString("#{6754}");
}
else
{
int actID = string.IsNullOrEmpty(infos[1]) ? -1 : Convert.ToInt32(infos[1]);
Tab_ActInfoClient tab = TableManager.GetActInfoClientByID(actID, 0);
if (tab != null)
{
desc.gameObject.SetActive(true);
desc.text = tab.ActName;
}
else
{
desc.gameObject.SetActive(false);
}
}
}
break;
case 10://仅展示
{
desc.gameObject.SetActive(true);
desc.text = info.info;
}break;
case 11:
{
desc.gameObject.SetActive(true);
switch (info.info)
{
case "0":
desc.text = StrDictionary.GetClientDictionaryString("#{49148}");
break;
case "1":
desc.text = StrDictionary.GetClientDictionaryString("#{49145}");
break;
case "2":
desc.text = StrDictionary.GetClientDictionaryString("#{49146}");
break;
case "3":
desc.text = StrDictionary.GetClientDictionaryString("#{49147}");
break;
default:
desc.gameObject.SetActive(false);
break;
}
}
break;
}
}
}