Exemplo n.º 1
0
        protected override string GetDefaultYirdName()
        {
            YirdData customData = CustomGameData.Mgr.Instance.GetYirdData(mUID);

            if (customData == null)
            {
                return(null);
            }

            return(customData.name);
        }
Exemplo n.º 2
0
        public void TravelTo(int worldIndex, Vector3 pos)
        {
            FastTravel.bTraveling = true;
            YirdData yd = CustomGameData.Mgr.Instance.curGameData.GetYirdData(worldIndex);

            if (yd == null)
            {
                return;
            }

            CustomGameData.Mgr.Instance.curGameData.WorldIndex = worldIndex;
            PeGameMgr.targetYird = yd.name;

            TravelTo(pos);
        }
Exemplo n.º 3
0
        public bool Load(string dir)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(dir, s_WorldDir));

            if (!dirInfo.Exists)
            {
                return(false);
            }

            mYirdData = new YirdData(dirInfo.FullName);

            //mDir = dir;


            return(true);
        }
Exemplo n.º 4
0
        static void TutorialLoader(YirdData yirdData, PeGameMgr.ETutorialMode tutorialMode)
        {
            Debug.Log("Now Load Tutorial Scene, Mode is: " + tutorialMode.ToString());

            Debug.Log(System.DateTime.Now.ToString("G") + "[Start Game Mode] " + "tutorial****************");

            bool bNewGame = true;

            PeLauncher.Instance.Add(new LoadTutorialPlayerSpawnPos(bNewGame));  //TODO this is test position

            PeLauncher.Instance.Add(new ResetGlobalData());

            PeLauncher.Instance.Add(new LoadCamera());

            PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, string.Empty));            //yirdData.terrainPath));
            //PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, yirdData.terrainPath));

            PeLauncher.Instance.Add(new LoadItemAsset(bNewGame));

            PeLauncher.Instance.Add(new LoadWaveSystem());

            PeLauncher.Instance.Add(new LoadCustomDoodad(bNewGame, yirdData.GetDoodads()));

            //PeLauncher.Instance.Add(new LoadCustomDragItem(bNewGame, customGame.GetItems()));

            PeLauncher.Instance.Add(new LoadCreature(bNewGame));

            PeLauncher.Instance.Add(new LoadEntityCreator(bNewGame));

            //PeLauncher.Instance.Add(new LoadCustomStory(bNewGame, customGame));

            PeLauncher.Instance.Add(new LoadGUI());

            PeLauncher.Instance.Add(new LoadCustomMap(bNewGame));

            PeLauncher.Instance.Add(new InitBuildManager(bNewGame)); //Add by  wang can

            PeLauncher.Instance.Add(new LoadTutorial());

            PeLauncher.Instance.Add(new LoadTutorialInitData(bNewGame));
        }
Exemplo n.º 5
0
        //        static void LoadCustom(bool bNewGame, YirdData yirdData)
        static void LoadCustom(bool bNewGame = true)
        {
            CustomGameData customData = CustomGameData.Mgr.Instance.GetCustomData(Pathea.PeGameMgr.mapUID);

            if (null != customData)
            {
                CustomGameData.Mgr.Instance.curGameData = customData;
            }

            YirdData yirdData = customData.curYirdData;

            if (null == yirdData)
            {
                Debug.LogError("custom game data is null");
                return;
            }
            Debug.Log(System.DateTime.Now.ToString("G") + "[Start Game Mode] " + "multi custom client");
            PeLauncher.Instance.Add(new ResetGlobalData());
            PeLauncher.Instance.Add(new LoadMultiPlayerSpawnPos());
            PeLauncher.Instance.Add(new LoadCamera());
            PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, yirdData.terrainPath));
            PeLauncher.Instance.Add(new LoadPathFinding());
            PeLauncher.Instance.Add(new LoadPathFindingEx());
            PeLauncher.Instance.Add(new LoadWaveSystem());
            PeLauncher.Instance.Add(new LoadEditedGrass(bNewGame, yirdData.grassPath));
            PeLauncher.Instance.Add(new LoadVETreeProtos(bNewGame));
            PeLauncher.Instance.Add(new LoadEditedTree(bNewGame, yirdData.treePath));
            PeLauncher.Instance.Add(new LoadEnvironment());
            PeLauncher.Instance.Add(new LoadFarm());
            PeLauncher.Instance.Add(new LoadColony());
            PeLauncher.Instance.Add(new LoadGUI());
            PeLauncher.Instance.Add(new LoadUiHelp(bNewGame));
            PeLauncher.Instance.Add(new InitBuildManager(bNewGame));
            PeLauncher.Instance.Add(new LoadMultiCustomCreature());
            //PeLauncher.Instance.Add(new LoadWorldCollider());
            PeLauncher.Instance.Add(new LoadCustomEntityCreator(bNewGame, yirdData));
            PeLauncher.Instance.Add(new LoadMultiCustom(bNewGame, customData));
            PlayerPackageCmpt.LockStackCount = false;
        }
Exemplo n.º 6
0
        public bool Load(string dir)
        {
//            DirectoryInfo dirInfo = new DirectoryInfo(dir);
//
//            if (!dirInfo.Exists)
//            {
//                return false;
//            }
//
//            DirectoryInfo[] subDirInfos = dirInfo.GetDirectories();
//
//            if (subDirInfos == null || subDirInfos.Length == 0)
//            {
//                return false;
//            }
//
//            foreach (DirectoryInfo subDirInfo in subDirInfos)
//            {
//                YirdData data = new YirdData(subDirInfo.FullName);
//
//                 mList.Add(data);
//            }
//
//            mDir = dir;

            string scenarioDir = Path.Combine(dir, s_ScenarioDir);

            if (!Directory.Exists(scenarioDir))
            {
                return(false);
            }

            //-- Load WorldSettings
            string wsfile = Path.Combine(scenarioDir, "WorldSettings.xml");

            if (!File.Exists(wsfile))
            {
                return(false);
            }

            // Read world setting file to a string
            string content = "";

            content = Pathea.IO.StringIO.LoadFromFile(wsfile, System.Text.Encoding.UTF8);

            // read the world name
            XmlDocument  doc    = new XmlDocument();
            StringReader reader = new StringReader(content);

            doc.Load(reader);

            XmlNode     root      = doc.SelectSingleNode("WORLDSETTINGS");
            XmlNodeList worldList = ((XmlElement)root).GetElementsByTagName("WORLD");

            foreach (XmlNode node in worldList)
            {
                XmlElement xe   = node as XmlElement;
                string     path = XmlUtil.GetAttributeString(xe, "path");
                mWorldNames.Add(path);
            }

            //-- Load ForceSettings
            string fsfile = Path.Combine(scenarioDir, "ForceSettings.xml");

            if (!File.Exists(fsfile))
            {
                return(false);
            }

            content = Pathea.IO.StringIO.LoadFromFile(fsfile, System.Text.Encoding.UTF8);
            ForceSetting.Instance.Load(content);

            mForceDescs.Clear();
            mPlayerDescs.Clear();

            mForceDescs.AddRange(ForceSetting.Instance.m_Forces);
            mPlayerDescs.AddRange(ForceSetting.Instance.m_Players);
            mHumanDescs.AddRange(ForceSetting.Instance.m_Players.FindAll(ret => ret.Type == EPlayerType.Human));

            //-- load world
            if (mWorldNames.Count == 0)
            {
                return(false);
            }

            string world_dir = Path.Combine(dir, s_WorldsDir);

            foreach (string filename in mWorldNames)
            {
                string _dir = Path.Combine(world_dir, filename);

                YirdData data = new YirdData(_dir);

                mList.Add(data);
            }

            mDir = dir;


            return(true);
        }
Exemplo n.º 7
0
//        static void LoadCustom(bool bNewGame, YirdData yirdData)
        static void LoadCustom(bool bNewGame, CustomGameData customData)
        {
            YirdData yirdData = customData.curYirdData;

            if (null == yirdData)
            {
                Debug.LogError("custom game data is null");
                return;
            }


            Debug.Log(System.DateTime.Now.ToString("G") + "[Start Game Mode] " + (!bNewGame ? "saved" : "new") + " Custom, path:" + yirdData.terrainPath + "****************");

            PeLauncher.Instance.Add(new ResetGlobalData());

            PeLauncher.Instance.Add(new LoadReputation(bNewGame));

            PeLauncher.Instance.Add(new LoadRandomItemMgr());

            PeLauncher.Instance.Add(new LoadCustomPlayerSpawnPos(bNewGame, customData.curPlayer.StartLocation));

            PeLauncher.Instance.Add(new LoadCamera());

            PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, yirdData.terrainPath));

            PeLauncher.Instance.Add(new LoadPathFinding());
            PeLauncher.Instance.Add(new LoadPathFindingEx());

            PeLauncher.Instance.Add(new LoadCreationData(bNewGame));
            PeLauncher.Instance.Add(new LoadItemAsset(bNewGame));

            PeLauncher.Instance.Add(new LoadWaveSystem());

            // Grass
            PeLauncher.Instance.Add(new LoadEditedGrass(bNewGame, yirdData.grassPath));

            // Tree
            PeLauncher.Instance.Add(new LoadVETreeProtos(bNewGame));
            PeLauncher.Instance.Add(new LoadEditedTree(bNewGame, yirdData.treePath));

            PeLauncher.Instance.Add(new LoadEnvironment());

            PeLauncher.Instance.Add(new LoadWorldInfo(bNewGame));

            //PeLauncher.Instance.Add(new LoadCustomMap(bNewGame));

            PeLauncher.Instance.Add(new LoadCustomDoodad(bNewGame, yirdData.GetDoodads()));

            PeLauncher.Instance.Add(new LoadCustomDragItem(yirdData.GetItems()));

            PeLauncher.Instance.Add(new LoadCustomSceneEffect(yirdData.GetEffects()));

            PeLauncher.Instance.Add(new LoadCustomCreature(bNewGame));

            PeLauncher.Instance.Add(new LoadCustomEntityCreator(bNewGame, yirdData));

            PeLauncher.Instance.Add(new LoadNPCTalkHistory(bNewGame));

            PeLauncher.Instance.Add(new LoadGUI());

            PeLauncher.Instance.Add(new LoadWorldCollider());

            PeLauncher.Instance.Add(new LoadUiHelp(bNewGame));

            PeLauncher.Instance.Add(new InitBuildManager(bNewGame));

            PeLauncher.Instance.Add(new LoadCustomStory(bNewGame, customData));

            PeLauncher.Instance.Add(new LoadSingleCustomInitData(bNewGame));

            PeLauncher.Instance.Add(new LoadLootItem(bNewGame));

            PeLauncher.Instance.Add(new LoadWorldCollider());

            PlayerPackageCmpt.LockStackCount = false;
        }