/// <summary> /// 呼叫結果事件 /// </summary> public static void CallAccident(AccidentEventData _data) { Data = _data; Reset();//重置事件 //設定事件內容 Text_Scenario.text = Data.Description; Text_Process.text = Data.Process; ShowAccidentUI(true); Coroutine = EventCoroutine(); MyAccident.StartCoroutine(Coroutine); }
/// <summary> /// 呼叫結果事件 /// </summary> public static void CallAccident(AccidentEventData _data) { Data = _data; Reset();//重置事件 //設定事件內容 Text_Scenario.text = Data.Description; Text_Process.text = Data.Process; ShowAccidentUI(true); Coroutine = EventCoroutine(); MyAccident.StartCoroutine(Coroutine); }
/// <summary> /// 將字典傳入,依json表設定資料 /// </summary> public static void SetData(Dictionary <int, List <AccidentEventData> > _dic) { string jsonStr = Resources.Load <TextAsset>("Json/AccidentEvent").ToString(); JsonData jd = JsonMapper.ToObject(jsonStr); JsonData items = jd["AccidentEvent"]; for (int i = 0; i < items.Count; i++) { AccidentEventData armorData = new AccidentEventData(items[i]); int id = int.Parse(items[i]["ID"].ToString()); int groupID = int.Parse(items[i]["GroupID"].ToString()); if (_dic.ContainsKey(groupID)) { _dic[groupID].Add(armorData); } else { List <AccidentEventData> eventDataList = new List <AccidentEventData>(); eventDataList.Add(armorData); _dic.Add(groupID, eventDataList); } } }
/// <summary> /// 將Json資料寫入字典裡 /// </summary> static void LoadJsonDataToDic() { //文字字典 String_AttributeDic = new Dictionary <string, String_AttributeData>(); String_AttributeData.SetData(String_AttributeDic); //Sprite字典 SpriteDic = new Dictionary <string, SpriteData>(); SpriteData.SetData(SpriteDic); //被動施法 PSpellDic = new Dictionary <int, PassiveSpellData>(); PassiveSpellData.SetData(PSpellDic); //主動施法 ASpellDic = new Dictionary <int, ActivitySpellData>(); ActivitySpellData.SetData(ASpellDic); DamageDic = new Dictionary <int, DamageData>(); DamageData.SetData(DamageDic); CureDic = new Dictionary <int, CureData>(); CureData.SetData(CureDic); BufferDic = new Dictionary <int, BufferData>(); BufferData.SetData(BufferDic); //天賦字典 TalentDic = new Dictionary <int, TalentData>(); TalentData.SetData(TalentDic); //武器 WeaponDic = new Dictionary <int, WeaponData>(); WeaponData.SetData(WeaponDic); //防具 ArmorDic = new Dictionary <int, ArmorData>(); ArmorData.SetData(ArmorDic); //裝備 ProtectorDic = new Dictionary <int, ProtectorData>(); ProtectorData.SetData(ProtectorDic); //裝備 DropDic = new Dictionary <int, DropData>(); DropData.SetData(DropDic); //冒險 AdventureDic = new Dictionary <int, AdventureData>(); AdventureData.SetData(AdventureDic); //出怪事件 MonsterEventDic = new Dictionary <int, MonsterEventData>(); MonsterEventData.SetData(MonsterEventDic); //調查事件 InvestigateEventDic = new Dictionary <int, List <InvestigateEventData> >(); InvestigateEventData.SetData(InvestigateEventDic); //意外事件 AccidentEventDic = new Dictionary <int, List <AccidentEventData> >(); AccidentEventData.SetData(AccidentEventDic); //結果事件 EventResultDic = new Dictionary <int, EventResultData>(); EventResultData.SetData(EventResultDic); //紮營事件 CampDic = new Dictionary <int, List <CampEventData> >(); CampEventData.SetData(CampDic); //怪物 MonsterGroupDic = new Dictionary <int, List <MonsterData> >(); MonsterDic = new Dictionary <int, MonsterData>(); MonsterData.SetData(MonsterGroupDic, MonsterDic); //腳色字典 RoleDic = new Dictionary <int, RoleData>(); RoleData.SetData(RoleDic); //主屬性字典 MainAttributeDic = new Dictionary <MainAttribute, MainAttributeData>(); MainAttributeData.SetData(MainAttributeDic); //等級字典 LevelDic = new Dictionary <int, LevelData>(); LevelData.SetData(LevelDic); }
/// <summary> /// 將字典傳入,依json表設定資料 /// </summary> public static void SetData(Dictionary<int, List<AccidentEventData>> _dic) { string jsonStr = Resources.Load<TextAsset>("Json/AccidentEvent").ToString(); JsonData jd = JsonMapper.ToObject(jsonStr); JsonData items = jd["AccidentEvent"]; for (int i = 0; i < items.Count; i++) { AccidentEventData armorData = new AccidentEventData(items[i]); int id = int.Parse(items[i]["ID"].ToString()); int groupID = int.Parse(items[i]["GroupID"].ToString()); if (_dic.ContainsKey(groupID)) _dic[groupID].Add(armorData); else { List<AccidentEventData> eventDataList = new List<AccidentEventData>(); eventDataList.Add(armorData); _dic.Add(groupID, eventDataList); } } }