using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using Newtonsoft.Json; /* 设备管理者(弓和箭的种类) */ public class DeviceMgr { static DeviceMgr _ins = null; public static DeviceMgr ins { get { if (_ins == null) { _ins = new DeviceMgr(); } return _ins; } } Hashtable deviceConfigs = new Hashtable(); DeviceMgr() { CacheDeviceConfig(); CacheDeviceConfig(); CacheDeviceConfig(); } void CacheDeviceConfig() where T : DeviceConfig { DeviceConfig deviceConfig = System.Activator.CreateInstance(); deviceConfigs.Add(deviceConfig.id, deviceConfig); } void CacheDeviceConfig(int id, DeviceConfig deviceConfig) { deviceConfigs.Add(id, deviceConfig); } public void UseDevice(DeviceInfo deviceInfo) { } public int GetCurrentBowPound() { return 0; } } public class DeviceInfo { public int id = 0; public bool inuse = false; [JsonIgnore] public DeviceConfig config = null; } public class DeviceConfig { public int id = 0; public int name = 0; public int detail = 0; public int difficulty = 0; public int model = 0; public int type = 0; } public class DeviceBowConfig : DeviceConfig { public int pound = 0; } public class DeviceBow1000 : DeviceBowConfig { public DeviceBow1000() { id = 1000; name = 201000; detail = 211000; difficulty = 3; model = 1; type = 1; pound = 18; } } public class DeviceBow1001 : DeviceBowConfig { public DeviceBow1001() { id = 1001; name = 201001; detail = 211001; difficulty = 5; model = 1; type = 1; pound = 25; } } public class DeviceArrow2000 : DeviceConfig { public DeviceArrow2000() { id = 2000; name = 201002; detail = 211002; difficulty = 3; model = 2; type = 2; } }