68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using MotionFramework;
|
|
using UnityEngine;
|
|
|
|
namespace DefaultNamespace
|
|
{
|
|
/// <summary>
|
|
/// 人物窗口装备管理器
|
|
/// </summary>
|
|
public class CharacterEquipManager : ModuleSingleton<CharacterEquipManager>, IModule
|
|
{
|
|
private Dictionary<string, Material> _equips; //装备集合
|
|
private List<Material> _cancel; //未穿戴材质球
|
|
private List<Material> _wear; //穿戴材质球
|
|
private GameObject equipBt;
|
|
|
|
public void OnCreate(object createParam)
|
|
{
|
|
_equips = new Dictionary<string, Material>();
|
|
_cancel = new List<Material>();
|
|
_wear = new List<Material>();
|
|
|
|
_cancel = Resources.LoadAll<Material>("Materials/CharacterEquip/Cancel").ToList();
|
|
_wear = Resources.LoadAll<Material>("Materials/CharacterEquip/Wear").ToList();
|
|
equipBt = Resources.Load<GameObject>("Prefabs/Window/CharacterEquip/CharacterEquipBt");
|
|
|
|
_equips.Add("帽子", null);
|
|
_equips.Add("手套", null);
|
|
_equips.Add("衣服", null);
|
|
}
|
|
|
|
public void OnUpdate()
|
|
{
|
|
}
|
|
|
|
public void OnDestroy()
|
|
{
|
|
}
|
|
|
|
public void OnGUI()
|
|
{
|
|
}
|
|
|
|
public void ChangeEquip(string equipName, bool isChange)
|
|
{
|
|
Material ma = null;
|
|
|
|
if (_equips.TryGetValue(equipName, out ma))
|
|
{
|
|
if (isChange)
|
|
{
|
|
ma = _wear.SingleOrDefault(s => s.name == equipName);
|
|
}
|
|
else
|
|
{
|
|
ma = _cancel.SingleOrDefault(s => s.name == equipName);
|
|
}
|
|
}
|
|
}
|
|
|
|
public GameObject GetEquipBt()
|
|
{
|
|
return equipBt;
|
|
}
|
|
}
|
|
} |