Beispiel #1
0
        public StoryEditorWorld(StateManager stateMgr)
        {
            this.mAge  = 0;
            this.mSeed = 42;
            this.mName = "SinglePlayer";

            this.mStateMgr = stateMgr;
            this.mStateMgr.SceneMgr.AmbientLight = ColourValue.ZERO;


            SceneNode node = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode(Vector3.ZERO);

            if (File.Exists(stateMgr.StoryInfo.pathToFile) && new FileInfo(stateMgr.StoryInfo.pathToFile).Length != 0)
            {
                this.mPath         = stateMgr.StoryInfo.pathToFile;
                this.mIslandLoaded = new FlatIsland(node, this, stateMgr.StoryInfo.pathToFile);
            }
            else
            {
                this.mIslandLoaded = new FlatIsland(node, new Vector2(1, 1), this);
            }

            this.mSkyMgr = new SkyMgr(this.mStateMgr);
        }
Beispiel #2
0
        public MainWorld(StateManager stateMgr)
        {
            this.mAge  = 0;
            this.mSeed = 42;
            this.mName = "SinglePlayer";

            this.mStateMgr = stateMgr;
            this.mStateMgr.SceneMgr.AmbientLight = ColourValue.ZERO;

            GameInfo info = this.mStateMgr.GameInfo;

            if (!info.Load)
            {
                SceneNode node = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode(Vector3.ZERO);
                if (info.Type == TypeWorld.Plains)
                {
                    this.mIslandLoaded = new RandomIsland(node, info.Size, new Plains(), this);
                }
                else if (info.Type == TypeWorld.Desert)
                {
                    this.mIslandLoaded = new RandomIsland(node, info.Size, new Desert(), this);
                }
                else if (info.Type == TypeWorld.Hills)
                {
                    this.mIslandLoaded = new RandomIsland(node, info.Size, new Hills(), this);
                }
                else
                {
                    this.mIslandLoaded = new RandomIsland(node, info.Size, new Mountains(), this);
                }

                if (info.Scenario != "")
                {
                    VanillaIsland isl = (VanillaIsland)this.mIslandLoaded;
                    isl.loadStructures(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SkyLands\\" + info.Scenario + "\\");

                    string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SkyLands\\" + info.Scenario + "\\";

                    string[] s = File.ReadAllLines(path + "structures.scenario");
                    for (int i = 0; i < s.Length; i++)
                    {
                        string[] ss = File.ReadAllLines(path + s[i] + ".event");

                        for (int j = 0; j < s.Length; j++)
                        {
                            string[] line = s[j].Split(' ');

                            if (line.Length >= 3)
                            {
                                Vector3 v = new Vector3(Convert.ToInt32(line[0]), Convert.ToInt32(line[1]), Convert.ToInt32(line[2]));

                                if (d.ContainsKey(v))
                                {
                                    d[v].Add(string.Join(" ", line, 3, line.Length - 3));
                                }
                                else
                                {
                                    d.Add(new Vector3(Convert.ToInt32(line[0]), Convert.ToInt32(line[1]), Convert.ToInt32(line[2])),
                                          new List <string> {
                                        string.Join(" ", line, 3, line.Length - 3)
                                    });
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                this.load();
            }
            this.mSkyMgr = new SkyMgr(this.mStateMgr);
        }