예제 #1
0
 /// <summary>
 /// 將字典傳入,依json表設定資料
 /// </summary>
 public static void SetData(Dictionary<int, MonsterEventData> _dic)
 {
     string jsonStr = Resources.Load<TextAsset>("Json/MonsterEvent").ToString();
     JsonData jd = JsonMapper.ToObject(jsonStr);
     JsonData items = jd["MonsterEvent"];
     for (int i = 0; i < items.Count; i++)
     {
         MonsterEventData armorData = new MonsterEventData(items[i]);
         int id = int.Parse(items[i]["ID"].ToString());
         _dic.Add(id, armorData);
     }
 }
예제 #2
0
    /// <summary>
    /// 傳入怪物事件取得怪物ID
    /// </summary>
    public static int[] GetMonsterIDsFromEvent(int _monsterEventID)
    {
        int[]            monsterIDs;
        MonsterEventData data = GameDictionary.MonsterEventDic[_monsterEventID];

        if (data.SpecificMonster != null && data.SpecificMonster.Length != 0)
        {
            monsterIDs = data.SpecificMonster;
        }
        else
        {
            int monsterNum = Random.Range(data.MinSpawn, data.MaxSpawn + 1);
            int groupIndex = 0;
            monsterIDs = new int[monsterNum];
            for (int i = 0; i < monsterNum; i++)
            {
                groupIndex    = Calculator.WeightIndexGetter(data.Group, data.GroupWeight);
                monsterIDs[i] = GetMonsterIDFromGroup(data.Group[groupIndex]);
            }
        }
        return(monsterIDs);
    }
예제 #3
0
 /// <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);
 }