Exemple #1
0
    public void Awake()
    {
        Instance = this;

        DataTableManager = new DataTableManager();
        DataTableManager.LoadTownTable(TestData.TownInfoTable);
        DataTableManager.FleetInfo = TestData.Fleet;
        DataTableManager.LoadCommodityTable(TestData.CommodityTable);
        var save = TestData.Saves;

        EntityList = new List<Entity>();

        //创建城镇
        GameDataManager = new GameObject("GameDataManager").AddComponent<GameDataManager>();
        GameDataManager.TownList = new List<Town>();
        foreach (var townInfo in DataTableManager.TownTable.Values)
        {
            var town = new Town();
            town.Info = townInfo;
            var townSave = save.TownList.Find(x => x.ID == townInfo.ID);
            if (null != townSave)
            {
                town.LoadSave(townSave);
            }
            GameDataManager.TownList.Add(town);
            EntityList.Add(town);
            town.Reset();
        }

        Map.Setup(GameDataManager.TownList);

        //创建舰队
        var fleet = new Fleet();
        fleet.Info = DataTableManager.FleetInfo;
        fleet.Position = new Vector2(0, 0);
        fleet.Actor = Map.transform.Find("Fleet").GetComponent<FleetActor>();
        fleet.Actor.Model = fleet;
        fleet.Reset();
        EntityList.Add(fleet);
        FocusedFleet = fleet;

        WorldTime = 0;
        TickCountDownRemaining = 0;
        //CurrentTownSettleSeconds = -1;
    }