| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- 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<DeviceBow1000>();
- CacheDeviceConfig<DeviceBow1001>();
- CacheDeviceConfig<DeviceArrow2000>();
-
- }
- void CacheDeviceConfig<T>() where T : DeviceConfig
- {
- DeviceConfig deviceConfig = System.Activator.CreateInstance<T>();
- 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;
- }
- }
|