54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Events;
|
|
using System.Collections;
|
|
using GCGame.Table;
|
|
using Games.Mission;
|
|
using Games.Events;
|
|
using Games.Item;
|
|
using Games.GlobeDefine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class CommonGMPackItem : UIItemBase
|
|
{
|
|
|
|
public InputField m_input;
|
|
public Toggle m_toggle;
|
|
public Text m_name;
|
|
public AttrInfo m_attarInfo;
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
m_attarInfo = (AttrInfo)hash["InitObj"];
|
|
if (m_name != null)
|
|
m_name.text = m_attarInfo.m_name;
|
|
if(m_input!=null)
|
|
{
|
|
m_input.text = "0";
|
|
m_input.onEndEdit.AddListener( OnAttrInputChange);
|
|
}
|
|
if(m_toggle!=null)
|
|
{
|
|
m_toggle.isOn = false;
|
|
m_toggle.onValueChanged.AddListener(OnToggleValueChange);
|
|
}
|
|
}
|
|
public void OnAttrInputChange(string text)
|
|
{
|
|
float attrValue = 0;
|
|
float.TryParse(text,out attrValue);
|
|
m_attarInfo.m_attrValue = attrValue;
|
|
m_attarInfo.m_isChange = true;
|
|
}
|
|
|
|
public void OnToggleValueChange(bool isOn)
|
|
{
|
|
m_attarInfo.m_attrValue = (isOn ? 1 : 0);
|
|
m_attarInfo.m_isChange = true;
|
|
}
|
|
|
|
}
|