80 lines
2.2 KiB
C#
80 lines
2.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using GCGame.Table;
|
|
using Module.Log;
|
|
using UnityEngine.UI;
|
|
|
|
public class MarketingModelIcon : MonoBehaviour {
|
|
|
|
public int tabID; // actClient表ID
|
|
public UICameraTexture model; // 模型贴图
|
|
|
|
private void Awake()
|
|
{
|
|
model._CanDrag = false;
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
Tab_ActInfoClient tab = TableManager.GetActInfoClientByID(tabID, 0);
|
|
if (tab == null)
|
|
{
|
|
LogModule.ErrorLog("Can't find id:" + tabID + " in Tab_ActInfoClient !");
|
|
return;
|
|
}
|
|
|
|
if (tab.ModelID == -1)
|
|
{
|
|
model.gameObject.SetActive(false);
|
|
}
|
|
|
|
// 显示模型
|
|
Tab_CharModel tab_W = TableManager.GetCharModelByID(tab.ModelID, 0);
|
|
if (tab_W != null)
|
|
{
|
|
model.gameObject.SetActive(true);
|
|
model.InitModelPath(tab_W.ResPath, tab_W, LoadAssetBundle.BUNDLE_PATH_MODEL, true);
|
|
|
|
var modelImage = model.transform.GetComponentInChildren<Image>();
|
|
if (modelImage)
|
|
modelImage.raycastTarget = false;
|
|
var modelRawImage = model.transform.GetComponentInChildren<RawImage>();
|
|
if (modelRawImage)
|
|
modelRawImage.raycastTarget = false;
|
|
}
|
|
else
|
|
{
|
|
model.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
|
|
//private void Start()
|
|
//{
|
|
// Tab_ActInfoClient tab = TableManager.GetActInfoClientByID(tabID, 0);
|
|
// if(tab == null)
|
|
// {
|
|
// LogModule.ErrorLog("Can't find id:" + tabID + " in Tab_ActInfoClient !");
|
|
// return;
|
|
// }
|
|
|
|
// if(tab.ModelID == -1)
|
|
// {
|
|
// model.gameObject.SetActive(false);
|
|
// }
|
|
|
|
// // 显示模型
|
|
// Tab_CharModel tab_W = TableManager.GetCharModelByID(tab.ModelID, 0);
|
|
// if (tab_W != null)
|
|
// {
|
|
// model.gameObject.SetActive(true);
|
|
// model.InitModelPath(tab_W.ResPath, tab_W, LoadAssetBundle.BUNDLE_PATH_MODEL, true);
|
|
// }
|
|
// else
|
|
// {
|
|
// model.gameObject.SetActive(false);
|
|
// }
|
|
//}
|
|
}
|