private void ToggleMoveScenery()
    {
        appStateManager.SetAnchorAndContainerIfNull();

        foreach (Transform item in appStateManager.currentSceneryContainer.transform)
        {
            GameObject currentSceneryItemObject = item.gameObject;
            Scenery    currentSceneryItem       = currentSceneryItemObject.GetComponent <Scenery>();

            if (currentSceneryItem.isSelected)
            {
                if (currentSceneryItem.isMoving)
                {
                    currentSceneryItem.isMoving = false;
                    currentlyMovingObject       = null;

                    DeselectAllScenery();
                }
                else
                {
                    currentSceneryItem.isMoving          = true;
                    currentlyMovingObject                = currentSceneryItemObject;
                    appStateManager.currentUIState       = UIStateEnum.SceneryButtonsOnly_SceneryMoving;
                    appStateManager.currentOutputMessage = $"Moving Selected Scenery. Point where you want it to go.  Click 'Stop Moving' when finished.";
                }
            }
        }
    }
Esempio n. 2
0
        /// <summary>
        /// 根据景点名称查询景点
        /// </summary>
        /// <param name="sceneryName"></param>
        /// <returns></returns>
        public static List <Scenery> Search(string sceneryName)
        {
            List <Scenery> sceneryList = new List <Scenery>();
            SqlConnection  con         = DBConnect.DBOpen();
            Scenery        scenery;
            DataSet        ds   = new DataSet();
            string         sql  = "SELECT top 1 [SYId],[SYIntroduce],[SYName],[SYSupplier],[SYImagSrc],[SYPrice],[SYTotal],[SYUseNum],[SYUseTime] FROM [Ebooking].[dbo].[Scenery] where SYName like '%" + sceneryName + "%'";
            SqlDataAdapter sqld = new SqlDataAdapter("SELECT [SYId],[SYIntroduce],[SYName],[SYSupplier],[SYImagSrc],[SYPrice],[SYTotal] ,[SYUseNum],[SYUseTime] FROM [Ebooking].[dbo].[Scenery] where SYName like '%" + sceneryName + "%'", con);

            sqld.Fill(ds, "user");
            DataTable         dTable = ds.Tables["user"];
            DataRowCollection rows   = dTable.Rows;

            if (rows.Count > 0)
            {
                for (int i = 0; i < rows.Count; i++)
                {
                    scenery             = new Scenery();
                    scenery.SYId        = Convert.ToInt32(rows[i][0]);
                    scenery.SYIntroduec = rows[i][1].ToString();
                    scenery.SYName      = rows[i][2].ToString();
                    scenery.SYSupplier  = Convert.ToInt32(rows[i][3]);
                    scenery.SYImagSrc   = rows[i][4].ToString();
                    scenery.SYPrice     = Convert.ToInt32(rows[i][5]);
                    scenery.SYTotal     = Convert.ToInt32(rows[i][6]);
                    scenery.SYUseNum    = Convert.ToInt32(rows[i][7]);
                    scenery.SYUseTime   = Convert.ToDateTime(rows[i][8]);

                    sceneryList.Add(scenery);
                }
            }
            DBConnect.DBClose();

            return(sceneryList);
        }
Esempio n. 3
0
        public static void EditModel()
        {
            int selX = game.selectedX;
            int selY = game.selectedY;

            //make the current model the object of the selected tile
            if (game.world.currentArea.tile[selX, selY].sceneryObject != null)
            {
                currentModel              = game.world.currentArea.tile[selX, selY].sceneryObject;
                editor.activeSceneryEdit  = currentModel;
                editor.editingBaseScenery = false; //we are editing a specific scenery instance rather than the template

                editor.modelNameBox.Text   = currentModel.name;
                editor.modelWidthBox.Text  = Convert.ToString(currentModel.size.X);
                editor.modelHeightBox.Text = Convert.ToString(currentModel.size.Y);
                editor.modelScriptBox.Text = currentModel.interactScript;
            }
            //otherwise make the current model null
            else
            {
                currentModel               = null;
                editor.activeSceneryEdit   = null;
                editor.modelNameBox.Text   = "";
                editor.modelWidthBox.Text  = "";
                editor.modelHeightBox.Text = "";
                editor.modelScriptBox.Text = "";
                editor.editingBaseScenery  = false;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 根据景点ID查询相应的景点
        /// </summary>
        /// <param name="SYId"></param>
        /// <returns></returns>
        public static Scenery SelectById(int SYId)
        {
            SqlConnection  con     = DBConnect.DBOpen();
            Scenery        scenery = new Scenery();
            DataSet        ds      = new DataSet();
            SqlDataAdapter sqld    = new SqlDataAdapter("SELECT SYName'景点名称',SYIntroduce'景点简介',SYSupplier'供应商',SYImagSrc'图片',SYPrice'价格',SYTotal'门票限额',SYUseTime'入园时间', SYUseNum '当前已售卖张数' FROM " + DBConfig.Scenery + "where SYId=" + SYId, con);

            sqld.Fill(ds, "user");
            DataTable         dTable = ds.Tables["user"];
            DataRowCollection rows   = dTable.Rows;

            if (rows.Count > 0)
            {
                for (int i = 0; i < rows.Count; i++)
                {
                    scenery             = new Scenery();
                    scenery.SYName      = rows[i][0].ToString();
                    scenery.SYIntroduec = rows[i][1].ToString();
                    scenery.SYSupplier  = Convert.ToInt32(rows[i][2]);
                    scenery.SYImagSrc   = rows[i][3].ToString();
                    scenery.SYPrice     = Convert.ToInt32(rows[i][4]);
                    scenery.SYTotal     = Convert.ToInt32(rows[i][5]);
                    scenery.SYUseTime   = Convert.ToDateTime(rows[i][6]);
                    scenery.SYUseNum    = Convert.ToInt32(rows[i][7]);
                }
            }
            DBConnect.DBClose();
            return(scenery);
        }
Esempio n. 5
0
        /// <summary>
        /// 景点展示 主页 前12条数据
        /// </summary>
        /// <returns></returns>
        public static List <Scenery> ShowImag(int pageNum)
        {
            List <Scenery> sceneryList = new List <Scenery>();
            Scenery        scenery;
            SqlConnection  con  = DBConnect.DBOpen();
            DataSet        ds   = new DataSet();
            SqlDataAdapter sqld = new SqlDataAdapter("SELECT TOP 12 [SYId],[SYName],[SYIntroduce],[SYSupplier],[SYImagSrc],[SYPrice] FROM " + DBConfig.Scenery + " where SYValid=1 and SYId not in(select top ((" + pageNum + "-1)*12) SYId from " + DBConfig.Scenery + ")", con);

            sqld.Fill(ds, "user");
            DataTable         dTable = ds.Tables["user"];
            DataRowCollection rows   = dTable.Rows;

            if (rows.Count > 0)
            {
                for (int i = 0; i < rows.Count; i++)
                {
                    scenery             = new Scenery();
                    scenery.SYId        = Convert.ToInt32(rows[i][0]);
                    scenery.SYName      = rows[i][1].ToString();
                    scenery.SYIntroduec = rows[i][2].ToString();
                    scenery.SYSupplier  = Convert.ToInt32(rows[i][3]);
                    scenery.SYImagSrc   = rows[i][4].ToString();
                    scenery.SYPrice     = Convert.ToInt32(rows[i][5]);
                    sceneryList.Add(scenery);
                }
            }
            DBConnect.DBClose();
            return(sceneryList);
        }
            /// <summary>
            /// Finds the desired MetaObject by name. If no meta object is found, NULL is returned.
            /// </summary>
            /// <param name="Name">Scenery name to search for.</param>
            /// <returns>
            /// Match: Last Matching MetaScenery Object
            /// Else:  "NoMetaScenery" Psuedo-Object.
            /// </returns>
            public static Scenery FindByName(string Name)
            {
                Scenery Output = None;

                if (Name == null)
                {
                    return(Output);
                }

                foreach (Scenery ThisMetaScenery in List)
                {
                    if (ThisMetaScenery == null)
                    {
                        continue;
                    }
                    if (ThisMetaScenery.Identify == null)
                    {
                        continue;
                    }
                    if (ThisMetaScenery.Identify.ToUpperInvariant() == Name.ToUpperInvariant())
                    {
                        Output = ThisMetaScenery;
                    }
                }
                if (Output == None)
                {
                    Log.Warning("Failed to find MetaData for scenery: " + Name + ".");
                }
                return(Output);
            }
 private static void HandleArrowKeys()
 {
     //arrow keys control the individual 'fine control' location of scenery models
     //ie, a translation matrix unique to each scenery object
     if (editor.toolTab.SelectedTab == editor.SceneryTab)
     {
         if ((editor.sceneryBox.SelectedItem != null || !editor.editingBaseScenery) && game.selectedX != -1 && game.selectedY != -1)
         {
             Scenery temp = null;
             if (editor.modelNewRadio.Checked && editor.sceneryBox.SelectedItem != null)
             {
                 temp = editor.sceneryList[(String)editor.sceneryBox.SelectedItem]; //alter the template
             }
             else if (editor.modelEditRadio.Checked)
             {
                 temp = ModelTool.currentModel;      //alter the placed object
             }
             //make sure we don't try to access a null reference
             if (temp != null)
             {
                 if (currentKeyState.IsKeyDown(Keys.Left))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(-0.03f, 0, 0);
                 }
                 if (currentKeyState.IsKeyDown(Keys.Right))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(0.03f, 0, 0);
                 }
                 if (currentKeyState.IsKeyDown(Keys.Down))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(0, 0, 0.03f);
                 }
                 if (currentKeyState.IsKeyDown(Keys.Up))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(0, 0, -0.03f);
                 }
                 if (currentKeyState.IsKeyDown(Keys.PageUp))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(0, 0.03f, 0);
                 }
                 if (currentKeyState.IsKeyDown(Keys.PageDown))
                 {
                     temp.translation = temp.translation * Matrix.CreateTranslation(0, -0.03f, 0);
                 }
                 if (currentKeyState.IsKeyDown(Keys.Home))
                 {
                     temp.translation = Matrix.CreateTranslation(0, 0, 0);
                 }
             }
         }
     }
     else if (editor.toolTab.SelectedTab == editor.NPCTab)
     {
         if (NPCTool.toolType == NPCToolType.SetPath)
         {
             PathTool.HandleKeys(prevKeyState, currentKeyState);
         }
     }
 }
Esempio n. 8
0
        private void modelHeightBox_TextChanged(object sender, EventArgs e)
        {
            if (modelEditRadio.Checked && sceneryBox.SelectedItem != null)
            {
                Scenery temp = sceneryList[(String)sceneryBox.SelectedItem];

                try
                {
                    int newSize = Convert.ToInt32(modelHeightBox.Text);
                    if (newSize >= 0)
                    {
                        temp.size.Y = newSize;
                    }
                }
                catch (Exception) { }
                SaveSceneryList();
            }
            else if (modelEditRadio.Checked && editingBaseScenery == false && activeSceneryEdit != null)
            {
                //expand or shrink to cover any non-occupied tile within the new size
                //will only apply to empty tiles or tiles that have the object to be edited
                Scenery temp = activeSceneryEdit;
                try
                {
                    //get new size from box (will throw exception if it fails)
                    int newSize = Convert.ToInt32(modelHeightBox.Text);

                    //remove all references to the object in the old size range
                    for (int x = temp.position.X; x < Math.Min(temp.position.X + temp.size.X, game.world.currentArea.mapWidth); x++)
                    {
                        for (int y = temp.position.Y; y < Math.Min(temp.position.Y + temp.size.Y, game.world.currentArea.mapHeight); y++)
                        {
                            if (game.world.currentArea.tile[x, y].sceneryObject == temp)
                            {
                                game.world.currentArea.tile[x, y].sceneryObject = null;
                            }
                        }
                    }
                    //update size
                    if (newSize >= 0)
                    {
                        temp.size.Y = newSize;
                    }
                    //add references to the object in the new size range
                    for (int x = temp.position.X; x < Math.Min(temp.position.X + temp.size.X, game.world.currentArea.mapWidth); x++)
                    {
                        for (int y = temp.position.Y; y < Math.Min(temp.position.Y + temp.size.Y, game.world.currentArea.mapHeight); y++)
                        {
                            if (game.world.currentArea.tile[x, y].sceneryObject == null)
                            {
                                game.world.currentArea.tile[x, y].sceneryObject = temp;
                            }
                        }
                    }
                }
                catch (Exception ex) { }
            }
        }
        public static bool LoadAll()
        {
            bool aircraftErrors = !Aircraft.LoadAll();
            bool groundErrors   = !Ground.LoadAll();
            bool sceneryErrors  = !Scenery.LoadAll();

            bool anyErrors = aircraftErrors | groundErrors | sceneryErrors;

            return(anyErrors);
        }
Esempio n. 10
0
 public TicketInfo(Scenery sceneryInfo, int userId)
 {
     scenery = sceneryInfo;
     UserId  = userId;
     InitializeComponent();
     if (scenery != null)
     {
         this.lbSceneryName2.Text = scenery.SYName;
         this.lbPrice2.Text       = scenery.SYPrice + "";
     }
 }
Esempio n. 11
0
    private void spawnSidewalk()
    {
        GameObject     obj  = new GameObject();
        SpriteRenderer sr   = obj.AddComponent <SpriteRenderer>();
        Scenery        tile = obj.AddComponent <Scenery>();

        obj.transform.parent      = sceneryFolder.transform;
        obj.name                  = "Sidewalk";
        tile.transform.localScale = new Vector3(1, 1, 0);
        tile.transform.position   = new Vector3(rdWidth / 2f + 1, 1.5f, 1);
        tile.init("sidewalk" + levelName, bgSpeed, this);
    }
Esempio n. 12
0
    private void spawnLine()
    {
        GameObject     obj  = new GameObject();
        SpriteRenderer sr   = obj.AddComponent <SpriteRenderer>();
        Scenery        line = obj.AddComponent <Scenery>();

        obj.transform.parent      = sceneryFolder.transform;
        obj.name                  = "Line";
        line.transform.localScale = new Vector3(1, 1, 0);
        line.transform.position   = new Vector3(rdWidth / 2f + 1, -1, 1);
        line.init("streetLine", bgSpeed, this);
    }
Esempio n. 13
0
        public static Scenery FromTag(H2vMap map, ScenarioTag scenario, ScenarioTag.SkyboxInstance instance)
        {
            var scenery = new Scenery();

            scenery.FriendlyName = "Skybox_" + instance.Skybox.Id;

            var tag = map.GetTag(instance.Skybox);

            if (map.TryGetTag(tag.Model, out var model) == false)
            {
                Console.WriteLine($"No MODE[{tag.Model}] found for SKY[{instance.Skybox}]");
                return(scenery);
            }

            var meshes = new List <ModelMesh>();

            var partIndex = model.Components.First().DamageLevels.First().HighestPieceIndex;

            meshes.AddRange(model.Parts[partIndex].Model.Meshes);

            var renderModelMeshes = new List <Mesh <BitmapTag> >(meshes.Count);

            foreach (var mesh in meshes)
            {
                var mat = map.CreateMaterial(mesh);

                renderModelMeshes.Add(new Mesh <BitmapTag>()
                {
                    Compressed  = mesh.Compressed,
                    ElementType = mesh.ElementType,
                    Indicies    = mesh.Indices,
                    Note        = mesh.Note,
                    RawData     = mesh.RawData,
                    Verticies   = mesh.Verticies,

                    Material = mat
                });
            }

            var comp = new RenderModelComponent(scenery, new Model <BitmapTag>
            {
                Note   = $"[{tag.Id}] {tag.Name}",
                Meshes = renderModelMeshes.ToArray(),
                Flags  = ModelFlags.IsSkybox
            });

            var components = new List <Component>();

            components.Add(comp);
            scenery.SetComponents(components.ToArray());

            return(scenery);
        }
Esempio n. 14
0
    public void Encode()
    {
        Scenery Sc = Scenery.Instance;

        Objects = new PlaceableObjectSerial[Sc.Objects.Count];
        for (int Idx = 0; Idx < Sc.Objects.Count; Idx++)
        {
            PlaceableObjectSerial POS = new PlaceableObjectSerial();
            POS.Encode(Sc.Objects[Idx]);
            Objects[Idx] = POS;
        }
    }
Esempio n. 15
0
        private void addButton_Click(object sender, EventArgs e)
        {
            Scenery newScenery = new Scenery();
            int     x          = editor.game.selectedX;
            int     y          = editor.game.selectedY;
            int     xSize      = 0;
            int     ySize      = 0;

            //get the size of the model if possible
            try
            {
                xSize = Convert.ToInt32(modelXSize.Text);
                ySize = Convert.ToInt32(modelYSize.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("This is not a valid size for the model");
                return;
            }

            //if we have a model selected then we can procede
            if (!String.IsNullOrWhiteSpace((String)modelBox.SelectedItem))
            {
                //add scenery to the selected tile
                newScenery = new Scenery(sceneryNameBox.Text,
                                         sceneryScriptBox.Text,
                                         modelBox.SelectedItem.ToString(),
                                         new Point(x, y),
                                         new Point(xSize, ySize));

                //move model to centre of selected size area
                newScenery.translation = Matrix.CreateTranslation((float)xSize / 2f, 0, (float)ySize / 2f);
            }
            //otherwise we tell the user to select a model
            else
            {
                MessageBox.Show("Select a Model first");
                return;
            }

            //try
            {
                editor.sceneryBox.Items.Add(newScenery.name);
                editor.sceneryList.Add(newScenery.name, newScenery);
            }
            //catch

            //hide rather than close to preserve list of models
            Hide();
            //select newly created scenery
            editor.sceneryBox.SelectedItem = newScenery.name;
        }
Esempio n. 16
0
        private void SerializeScenery(Scenery scenery, string filename)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                var writer     = new StreamWriter(ms, Encoding.UTF8);
                var serializer = new XmlSerializer(typeof(Scenery));
                serializer.Serialize(writer, scenery);
                writer.Flush();

                //if the serialization succeed, rewrite the file.
                File.WriteAllBytes(filename, ms.ToArray());
            }
        }
Esempio n. 17
0
 public static void SaveScenery(Scenery scenery, BinaryWriter writer)
 {
     writer.Write(scenery.name);
     writer.Write(scenery.interactScript);
     writer.Write(scenery.modelName);
     writer.Write(scenery.position.X);
     writer.Write(scenery.position.Y);
     writer.Write(scenery.size.X);
     writer.Write(scenery.size.Y);
     SaveMatrix(scenery.scale, writer);
     SaveMatrix(scenery.translation, writer);
     SaveMatrix(scenery.rotation, writer);
 }
Esempio n. 18
0
 public IconDrawerFactory(int zoomLevel, Scenery scenery)
     : base(CreateZoom(zoomLevel))
 {
     if (scenery == Scenery.Old)
     {
         _activeBackground = _background;
     }
     else
     {
         Debug.Assert(scenery == Scenery.New);
         _activeBackground = _background2;
     }
 }
Esempio n. 19
0
        public static SortedList <string, Scenery> LoadSceneryList(BinaryReader reader)
        {
            SortedList <string, Scenery> list = new SortedList <string, Scenery>();
            int num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                Scenery s = LoadScenery(reader);
                list.Add(s.name, s);
            }

            return(list);
        }
Esempio n. 20
0
        private static void AddAtLocation(uint id, Vector3 position, Vector4 color, Scene destination)
        {
            var item  = new Scenery();
            var model = new RenderModelComponent(item, ModelFactory.UnitPyramid(color));

            var xform = new TransformComponent(item, position);

            item.SetComponents(new Component[] {
                model,
                xform
            });

            destination.Entities.Add(Guid.NewGuid(), item);
        }
Esempio n. 21
0
        /// <summary>
        /// 景点更新或添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            string   SceneryName = this.tbSceneryName.Text;
            int      Supplier    = Convert.ToInt32(this.tbSupplierId.Text);
            int      price       = Convert.ToInt32(this.tbPrice.Text);
            string   Introduce   = this.tbIntroduce.Text;
            int      TotalNum    = Convert.ToInt32(this.tbTKTotalNum.Text);
            DateTime useTime     = Convert.ToDateTime(this.dtpTKUseTime.Text);
            string   path        = Path;

            if (this.button2.Text == "更新")
            {
                Scenery scenery = new Scenery();
                scenery.SYName      = SceneryName;
                scenery.SYSupplier  = Supplier;
                scenery.SYPrice     = price;
                scenery.SYIntroduec = Introduce;
                scenery.SYImagSrc   = path;
                scenery.SYTotal     = TotalNum;
                scenery.SYUseTime   = useTime;
                scenery.SYId        = SYId;
                if (SceneryAccess.SceneryUpdateForSupplier(scenery))
                {
                    MessageBox.Show("更新成功");
                }
                else
                {
                    MessageBox.Show("更新失败!");
                }
            }
            else
            {
                Scenery scenery = new Scenery();
                scenery.SYName      = SceneryName;
                scenery.SYSupplier  = Supplier;
                scenery.SYPrice     = price;
                scenery.SYIntroduec = Introduce;
                scenery.SYImagSrc   = path;
                scenery.SYTotal     = TotalNum;
                scenery.SYUseTime   = useTime;
                if (SceneryAccess.SceneryAdd(scenery))
                {
                    MessageBox.Show("添加成功");
                }
                else
                {
                    MessageBox.Show("添加失败!");
                }
            }
        }
Esempio n. 22
0
        private void importScenery_Click(object sender, EventArgs e)
        {
            foreach (Scenery s in game.world.currentArea.scenery)
            {
                Scenery tmp = null;
                if (!sceneryList.TryGetValue(s.name, out tmp))
                {
                    sceneryList.Add(s.name, s);
                    sceneryBox.Items.Add(s.name);
                }
            }

            SaveSceneryList();
        }
Esempio n. 23
0
 /// <summary>
 /// 界面初始化
 /// </summary>
 private void Initlize()
 {
     scenery = SceneryAccess.SelectById(SYId);
     this.tbSceneryName.Text = scenery.SYName;
     this.tbIntroduce.Text   = scenery.SYIntroduec;
     this.tbPrice.Text       = scenery.SYPrice + "";
     this.tbSupplierId.Text  = scenery.SYSupplier + "";
     this.tbTKTotalNum.Text  = scenery.SYTotal + "";
     this.dtpTKUseTime.Text  = scenery.SYUseTime + "";
     Path = scenery.SYImagSrc;
     if (Path != null)
     {
         pictureBox1.Image = Image.FromFile(Path);
     }
 }
Esempio n. 24
0
        private void modelScriptBox_TextChanged(object sender, EventArgs e)
        {
            if (modelEditRadio.Checked && sceneryBox.SelectedItem != null && editingBaseScenery == true)
            {
                Scenery temp = sceneryList[(String)sceneryBox.SelectedItem];

                temp.interactScript = modelScriptBox.Text;
            }
            else if (modelEditRadio.Checked && editingBaseScenery == false && activeSceneryEdit != null)
            {
                Scenery temp = activeSceneryEdit;

                temp.interactScript = modelScriptBox.Text;
            }
        }
Esempio n. 25
0
    public void Decode()
    {
        Scenery Sc = Scenery.Instance;

        Sc.RemoveObjects();
        if (Objects == null)
        {
            return;                   //In case we are loading a blank track
        }
        foreach (PlaceableObjectSerial POS in Objects)
        {
            PlaceableObject PO = POS.Decode();
            Sc.Objects.Add(PO);
        }
    }
Esempio n. 26
0
        public LoadSceneryXML(string end)
        {
            try
            {
                TextReader    stringReader  = new StringReader(end);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(Scenery));
                m_scenery    = (Scenery)xmlSerializer.Deserialize(stringReader);
                deserialized = true;
                if (debug)
                {
                    Console.WriteLine(new object[] { string.Concat(new string[] { "Scenery X:", m_scenery.Terrain.aabb_min[0].ToString("F1"), " ~ ", m_scenery.Terrain.aabb_max[0].ToString("F1"), "  Z:", m_scenery.Terrain.aabb_min[1].ToString("F1"), " ~ ", m_scenery.Terrain.aabb_max[1].ToString("F1") }) });
                }
                m_mapHeight = (double)(m_scenery.Terrain.aabb_max[1] - m_scenery.Terrain.aabb_min[1]);
                m_mapWidth  = (double)(m_scenery.Terrain.aabb_max[0] - m_scenery.Terrain.aabb_min[0]);
                int count = m_scenery.TerrainAttr.SurfaceAttrTriangle.attributes.Count;
                m_hitEdge      = new Dictionary <int, int[]>();
                m_noEntryIndex = new List <int>();
                for (int i = 0; i < count; i++)
                {
                    if (m_scenery.TerrainAttr.SurfaceAttrTriangle.attributes[i] == 32768)
                    {
                        m_noEntryIndex.Add(i);
                        int item  = m_scenery.TerrainAttr.SurfaceAttrTriangle.vertexIndices[i][0];
                        int item1 = m_scenery.TerrainAttr.SurfaceAttrTriangle.vertexIndices[i][1];
                        int num1  = m_scenery.TerrainAttr.SurfaceAttrTriangle.vertexIndices[i][2];
                        Console.WriteLine("InsertEdge: {0} - {1}", item, item1);
                        Console.WriteLine("InsertEdge: {0} - {1}", item1, num1);
                        Console.WriteLine("InsertEdge: {0} - {1}", num1, item);

                        //this.InsertEdge(item, item1);
                        //this.InsertEdge(item1, num1);
                        //this.InsertEdge(num1, item);
                    }
                }
                Console.WriteLine(string.Concat(new object[] { "#DegugLog StaticObj.m_scenery.TerrainAttr: \nKDTree.nodes.axis.Count:", m_scenery.TerrainAttr.KDTree.nodes.axis.Count, "\nSurfaceAttrTriangle.attributes.Count:", m_scenery.TerrainAttr.SurfaceAttrTriangle.attributes.Count, "\nSurfaceAttrTriangle.vertexIndices.Count:", m_scenery.TerrainAttr.SurfaceAttrTriangle.vertexIndices.Count, "\nVertex.data.Count:", m_scenery.TerrainAttr.Vertex.data.Count, "\n" }));
            }
            catch (Exception exception1)
            {
                Globals.printException(exception1);

                Exception exception = exception1;
                Console.WriteLine(string.Concat("Exception caught. ", exception.Message));
                if (debug)
                {
                    Console.WriteLine(new object[] { string.Concat("Exception caught. ", exception.Message) });
                }
            }
        }
Esempio n. 27
0
    void Start()
    {
        //实例化一种修图软件
        IChangepicture ICP = new AI();
        //实例化风景照
        Scenery scenery = new Scenery(ICP);

        //调用风景照的change()方法
        scenery.Change();
        People people = new People(ICP);

        people.Change();
        Food food = new Food(ICP);

        food.Change();
    }
Esempio n. 28
0
        public static Scenery LoadScenery(BinaryReader reader)
        {
            Scenery scenery = new Scenery();

            scenery.name           = reader.ReadString();
            scenery.interactScript = reader.ReadString();
            scenery.modelName      = reader.ReadString();
            scenery.position.X     = reader.ReadInt32();
            scenery.position.Y     = reader.ReadInt32();
            scenery.size.X         = reader.ReadInt32();
            scenery.size.Y         = reader.ReadInt32();
            scenery.scale          = LoadMatrix(reader);
            scenery.translation    = LoadMatrix(reader);
            scenery.rotation       = LoadMatrix(reader);

            return(scenery);
        }
Esempio n. 29
0
 private void label1_Click_1(object sender, EventArgs e)
 {
     this.Visible = false;
     if (indexer != -1)
     {
         Scenery scenery = new Scenery();
         scenery = SceneryAccess.SelectById(SYId);
         TicketInfo ticketInfo = new TicketInfo(scenery, DTId);
         ticketInfo.Show();
     }
     else
     {
         MessageBox.Show("请选择要预订的门票");
         DistributorUser distributor = new DistributorUser(DTId);
         distributor.Show();
     }
 }
Esempio n. 30
0
        public static void DrawScenery(Scenery s, int x, int y, short z)
        {
            if (s != null)
            {
                if (File.Exists("Content\\Models\\" + s.modelName + ".xnb"))
                {
                    Model mod = contentManager.Load <Model>("Models\\" + s.modelName);

                    graphics.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
                    // Copy any parent transforms.
                    Matrix[] transforms = new Matrix[mod.Bones.Count];
                    mod.CopyAbsoluteBoneTransformsTo(transforms);
                    foreach (ModelMesh mesh in mod.Meshes)
                    {
                        effect.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * s.rotation * s.scale * s.translation * Matrix.CreateTranslation(new Vector3(x + s.position.X - 0.5f, (float)z / 8f, y + s.position.Y - 0.5f)));
                        effect.Parameters["View"].SetValue(view);
                        effect.Parameters["Projection"].SetValue(projection);

                        // Draw the mesh, using the effects set above.
                        foreach (ModelMeshPart part in mesh.MeshParts)
                        {
                            graphics.GraphicsDevice.Textures[0] = part.Effect.Parameters["Texture"].GetValueTexture2D();
                            if (part.VertexBuffer.VertexDeclaration.VertexStride == 40)
                            {
                                effect.CurrentTechnique = effect.Techniques[0];
                            }
                            else
                            {
                                effect.CurrentTechnique = effect.Techniques[1];
                            }
                            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                            {
                                pass.Apply();
                                graphics.GraphicsDevice.SetVertexBuffer(part.VertexBuffer);
                                graphics.GraphicsDevice.Indices = part.IndexBuffer;
                                graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, part.VertexOffset, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 31
0
        protected override void Initialize()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            device = graphics.GraphicsDevice;

            // ScreenWidth = device.PresentationParameters.BackBufferWidth;
            // ScreenHeight = device.PresentationParameters.BackBufferHeight;

            ScreenWidth = (int)graphics.PreferredBackBufferWidth;
            ScreenHeight = (int)graphics.PreferredBackBufferHeight;

            SystemFunctions.Sound.PlayIngameMusic();

            Font = Content.Load<SpriteFont>("Segoe UI Mono");
            AllMessages = new Toolbar.SystemMsg(Font);
            MainScenery = new Scenery();

            inventoryArea = new Rectangle(475, ScreenHeight - 110, 206, 100);

            base.Initialize();
        }
Esempio n. 32
0
 public IconDrawerFactory(int zoomLevel, Scenery scenery)
     : base(CreateZoom(zoomLevel))
 {
     if (scenery == Scenery.Old)
     {
         _activeBackground = _background;
     }
     else
     {
         Debug.Assert(scenery == Scenery.New);
         _activeBackground = _background2;
     }
 }