You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.4 KiB
113 lines
2.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using LzFramework.UI;
|
|
using LzFramework.FSM.Msg;
|
|
|
|
|
|
namespace DisComputer
|
|
{
|
|
|
|
/*
|
|
* @func 零件背包界面
|
|
* @author lz
|
|
* @date 2020/05/28
|
|
*
|
|
*/
|
|
public class SparePartsView : TTUIPage
|
|
{
|
|
public SparePartsView() : base(UIType.Normal, UIMode.DoNothing, UICollider.None)
|
|
{
|
|
uiPath = "UIPrefabs/SparePartsView";
|
|
}
|
|
|
|
public SpareGrids spareGrids;
|
|
|
|
public override void Awake(GameObject go)
|
|
{
|
|
GameObject tempSpareGo = this.transform.Find("Grids").gameObject;
|
|
spareGrids = tempSpareGo.GetComponent<SpareGrids>();
|
|
spareGrids.InitScale();
|
|
InitMsg();
|
|
}
|
|
|
|
public override void Active()
|
|
{
|
|
spareGrids.OnShow(data);
|
|
|
|
}
|
|
|
|
public override void Hide()
|
|
{
|
|
spareGrids.OnHide();
|
|
}
|
|
|
|
public override void Refresh()
|
|
{
|
|
|
|
}
|
|
|
|
#region logicl
|
|
void InitMsg()
|
|
{
|
|
MessageDispatcher.AddListener(MsgName.SparePartsViewShowSpare, OnRecShowSpareView);
|
|
|
|
MessageDispatcher.AddListener(MsgName.SparePartsViewAddSpare, OnRecAddSpareGird);
|
|
|
|
MessageDispatcher.AddListener(MsgName.SparePartsViewRemoveSpare,OnRecRemoveSpareGrid);
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示零件包
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
void OnRecShowSpareView(IMessage message)
|
|
{
|
|
|
|
spareGrids.OnShow();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加零件到包
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
void OnRecAddSpareGird(IMessage message)
|
|
{
|
|
|
|
try
|
|
{
|
|
//SpareType type = (SpareType)message.Data;
|
|
//spareGrids.AddSpareToGrid(type);
|
|
SpareInfo info = (SpareInfo)message.Data;
|
|
spareGrids.AddSpareToGrid(info);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
Debug.LogFormat(">>>{0}", ex);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 移除零件背包零件
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
void OnRecRemoveSpareGrid(IMessage message)
|
|
{
|
|
spareGrids.ResetAllGrid();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|
|
|