예제 #1
0
 public void LoadChapterDef(int id)
 {
     if (ChapterDef != null && Event.gameObject != null)
     {
         GameObject.DestroyImmediate(Event.gameObject);
     }
     ChapterDef       = ResourceManager.GetChapterDef(id);
     ChapterDef.Event = GameObject.Instantiate(ChapterDef.Event);
     ChapterId        = id;
 }
예제 #2
0
    public void NewGameData(int slot)
    {
        Clear();
        ChapterRecordCollection collect = new ChapterRecordCollection();

        collect.Slot = slot;
        ChapterDef   = ResourceManager.GetChapterDef(0);
        SaveChapterData(slot);
        LoadChapterData(slot);
    }
예제 #3
0
    public static ChapterSettingDef GetChapterDef(int ChapterIndex)
    {
        ChapterSettingDef def = Resources.Load <ChapterSettingDef>(Path.Combine(ASSET_CHAPTERSETTING, ChapterIndex.ToString()));
        ChapterSettingDef r   = GameObject.Instantiate <ChapterSettingDef>(def);

        if (r.Event == null)
        {
            Debug.LogError("你需要在ChapterDef" + r.CommonProperty.ID + "中指定Event");
        }
        r.Event.SetChapterDef(r);
        return(r);
    }
예제 #4
0
 public void OnEnable()
 {
     chapter           = target as ChapterSettingDef;
     forceInvolveCount = chapter.ForceInvolve.Count;
     weaponRoomCount   = chapter.WeaponRoom.Count;
     propRoomCount     = chapter.PropRoom.Count;
     if (chapter.BGMSetting.Count != bgmType.Length)
     {
         chapter.BGMSetting.Clear();
         chapter.BGMSetting.AddRange(new int[bgmType.Length]);
     }
 }
예제 #5
0
        public static ChapterSettingDef CreateWeapon()
        {
            int count = ScriptableObjectUtility.GetFoldFileCount(DIRECTORY_PATH);

            ChapterSettingDef chap = ScriptableObjectUtility.CreateAsset <ChapterSettingDef>(
                count.ToString(),
                DIRECTORY_PATH,
                true
                );

            chap.CommonProperty.ID = count;
            return(chap);
        }
예제 #6
0
    /// <summary>
    /// 载入事件数据,加载我方和敌方数据,并加载单位到战场上。
    /// </summary>
    /// <param name="slot"></param>
    public void LoadBattleData(int slot)
    {
        Clear();
        BattleInfoCollection data = record.LoadBattleFromDisk(slot);

        //Debug.Log(collect.Event.TurnEvent[0].SequenceName);
        ChapterDef = ResourceManager.GetChapterDef(data.CurrentTeam.Chapter);
        gameMode.LoadTileMap(data.MapID);
        players.PlayersLogic.Clear();
        foreach (var v in data.CurrentTeamPlayerInfo)
        {
            RPGPlayer p = RPGPlayer.Create(v);
            players.PlayersLogic.Add(p.Logic);
            gameMode.BattlePlayer.AddUnitToMap(p, v.tileCoords);
        }
    }
예제 #7
0
    public static string GetChapterName(int ChapterIndex)
    {
        ChapterSettingDef def = GetChapterDef(ChapterIndex);

        return(def.CommonProperty.Name);
    }
예제 #8
0
 public void SetChapterDef(ChapterSettingDef def)
 {
     chapterDef = def;
 }