Exemplo n.º 1
0
        public LayMapTilePattern(LayEntity parentEntity)
        {
            m_ParentEntity = parentEntity;

            m_Filename = parentEntity.GetProperty("PatternFilename");
            m_Index = parentEntity.GetProperty("PatternIndex");
            m_Status = parentEntity.GetProperty("Status");
            int x = parentEntity.GetProperty("PatternX").Value.ToInteger()-1;
            int y = parentEntity.GetProperty("PatternY").Value.ToInteger()-1;
            m_Location = new Point(x, y);
        }
Exemplo n.º 2
0
        public LayMapTilePattern(LayEntity parentEntity)
        {
            m_ParentEntity = parentEntity;

            m_Filename = parentEntity.GetProperty("PatternFilename");
            m_Index    = parentEntity.GetProperty("PatternIndex");
            m_Status   = parentEntity.GetProperty("Status");
            int x = parentEntity.GetProperty("PatternX").Value.ToInteger() - 1;
            int y = parentEntity.GetProperty("PatternY").Value.ToInteger() - 1;

            m_Location = new Point(x, y);
        }
Exemplo n.º 3
0
        private void ProcessEntity(LayEntity value)
        {
            txtHeat.Text = m_Entity.GetProperty("HeatLevel").Value;
            txtNotoriety.Text = m_Entity.GetProperty("NotorietyLevel").Value;
            txtTouristNumber.Text = m_Entity.GetProperty("DesiredTouristPopulation").Value;

            if (m_Entity.GetProperty("SuperAgentLocked").Value == "true")
                chkAUnlocked.Checked = false;
            else
                chkAUnlocked.Checked = true;

            if (m_Entity.GetProperty("SuperAgentDefeated").Value == "true")
                chkADefeated.Checked = true;
            else
                chkADefeated.Checked = false;

            groupBox1.Text = RegionName;
        }
Exemplo n.º 4
0
        public List <LayEntity> GetObjectEntities(int x, int y)
        {
            List <LayEntity> res = new List <LayEntity>();

            foreach (LayEntity ent in Entities)
            {
                if (ent.Pattern == null)
                {
                    continue;
                }

                if (ent.EntityDescriptionID == "13109")
                {
                    LayEntity entx = ent;
                }
                if ((ent.Pattern.Location.X + 1 == x) && (ent.Pattern.Location.Y + 1 == y))
                {
                    res.Add(ent);
                }
            }

            return(res);
        }
Exemplo n.º 5
0
 public LayMapTileGrid(LayEntity parentEntity)
 {
     m_ParentEntity = parentEntity;
 }
Exemplo n.º 6
0
        private void RenderObject(LayEntity obj)
        {
            OGLTexture text = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Objects\" + obj.EntityDescriptionID + ".png"));

            if (text == null)
            {
                OGLTools.DrawFilledRectangle(Color.Green, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize));
                return;
            }

            OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize), 1f);
        }
Exemplo n.º 7
0
        private void ProcessEntity(LayEntity value)
        {
            LayEntity hench = m_Entity;
            GroupBox hBox = groupBox2;

            for (int c2 = 0; c2 < hBox.Controls.Count; c2++)
            {
                Control ctrl2 = hBox.Controls[c2];

                string ctrlTag = (string)ctrl2.Tag;

                switch (ctrlTag)
                {
                    case "Name":
                        ((TextBox)ctrl2).Text = hench.Name;
                        break;
                    case "Health":
                        ((TextBox)ctrl2).Text = hench.Stats.Health;
                        break;
                    case "Smarts":
                        ((TextBox)ctrl2).Text = hench.Stats.Smarts;
                        break;
                    case "Loyalty":
                        ((TextBox)ctrl2).Text = hench.Stats.Loyalty;
                        break;
                    case "Endurance":
                        ((TextBox)ctrl2).Text = hench.Stats.Endurance;
                        break;
                    case "Attention":
                        ((TextBox)ctrl2).Text = hench.Stats.Attention;
                        break;
                    case "Lives":
                        try
                        {
                            ((ComboBox)ctrl2).SelectedIndex = hench.Stats.Lives.ToInteger();
                        }
                        catch { }
                        break;

                    case "Abilities": // groupbox
                        for (int c3 = 0; c3 < ((GroupBox)ctrl2).Controls.Count; c3++)
                        {
                            Control ctrl3 = ((GroupBox)ctrl2).Controls[c3];

                            int index = 0;

                            switch ((string)ctrl3.Tag)
                            {
                                case "Skill1":
                                    ComboBox cbS1 = (ComboBox)ctrl3;
                                    foreach (string skill in cbS1.Items)
                                    {
                                        if (skill == hench.GetProperty("SpecialAbility", 1).Value)
                                        {
                                            cbS1.SelectedIndex = index;
                                            break;
                                        }
                                        index++;
                                    }
                                    break;
                                case "Skill2":
                                    ComboBox cbS2 = (ComboBox)ctrl3;
                                    foreach (string skill in cbS2.Items)
                                    {
                                        if (skill == hench.GetProperty("SpecialAbility", 2).Value)
                                        {
                                            cbS2.SelectedIndex = index;
                                            break;
                                        }
                                        index++;
                                    }
                                    break;
                                case "Skill1Learned":
                                    CheckBox cb1 = (CheckBox)ctrl3;

                                    if (hench.GetProperty("TrainingComplete", 1).Value == "true")
                                        cb1.Checked = true;
                                    else
                                        cb1.Checked = false;
                                    break;
                                case "Skill2Learned":
                                    CheckBox cb2 = (CheckBox)ctrl3;

                                    if (hench.GetProperty("TrainingComplete", 2).Value == "true")
                                        cb2.Checked = true;
                                    else
                                        cb2.Checked = false;
                                    break;
                            }
                        }
                        break;
                }
            }
        }
Exemplo n.º 8
0
        private void LoadFields(EvilPlug.Filetypes.Lay.LayFile layObject)
        {
            try
            {
                txtMoney.Text = layObject.FindProperty("Cash").Value;
                if (layObject.FindProperty("GeniusEntityID") == null)
                    throw new Exception("Invalid savegame.");

                m_GeniusEntityID = layObject.FindProperty("GeniusEntityID").Value;

                cmbAlertState.SelectedIndex = int.Parse(layObject.FindProperty("AlertStatus").Value);
                cmbDifficulty.SelectedIndex = int.Parse(layObject.FindProperty("DifficultyLevel").Value);

                // Find the evil genius entry
                m_EvilGenius = layObject.FindEntityById(m_GeniusEntityID);

                txtEGHealth.Text = m_EvilGenius.Stats.Health;
                txtEGName.Text = m_EvilGenius.Name;
                txtEGID.Text = m_EvilGenius.EntityDescriptionID;
                txtEGLoyalty.Text = m_EvilGenius.Stats.Loyalty;
                txtEGSmarts.Text = m_EvilGenius.Stats.Smarts;
                txtEGAttention.Text = m_EvilGenius.Stats.Attention;
                txtEGEndurance.Text = m_EvilGenius.Stats.Endurance;

                // Load the minion recruitment fields
                for (int c = 0; c < grpRec.Controls.Count; c++)
                {
                    Control ctrl = grpRec.Controls[c];

                    if (ctrl.GetType() == typeof(TextBox))
                    {
                        string minID = (string)((TextBox)ctrl).Tag;

                        // Load minion stuff
                        List<LayProperty> props = SaveGamePlugin.LayFile.FindProperties("DesiredMinionCount");

                        for (int i = 0; i < props.Count; i++)
                        {
                            LayProperty prop = props[i];

                            try
                            {
                                if (prop.Value.Substring(0, 4) == minID + ",")
                                {
                                    ((TextBox)ctrl).Text = prop.Value.Substring(prop.Value.IndexOf(",") + 1);
                                    break;
                                }
                            }
                            catch { }
                        }

                    }
                }

                txtRecCost.Text = layObject.FindProperty("MinionRecruitmentCost").Value;
                txtRecRate.Text = layObject.FindProperty("MinionRecruitmentRate").Value;
                txtRecTime.Text = layObject.FindProperty("SecondsSinceLastAutoSpawned").Value;

                txtBasePower.Text = layObject.FindProperty("BasePowerSupply").Value;

                #region Load henchmen tab
                string[] henchmenIds = new string[] { "500", "501", "502", "503", "504", "505", "507", "508", "509", "510", "511" };
                string[] henchNames = new string[] { "Moko the big strong dumb one.", "Jubei the Samurai swordsman and sushi master.", "Eli the hard-hitting, fast-talking gangster.", "Red Ivan, always ready for action.", "Montezuma, the dark and sinister voodoo man.", "The Matron - isn't it past your bedtime?", "Lord Kane, the arch-conspirator himself.", "That looks nasty, would you like me to take a closer look?", "Look into my eye, you are feeling sleepy...", "The charming Dr Neurocide, insane or genius ahead of her time?", "Colonel Blackheart, he has your trail." };

                bool found = false;
                int locModifier = 0;

                GroupBox baseBox = null;

                for (int c = 0; c < tabHenchman.Controls.Count; c++)
                {
                    Control ctrl = tabHenchman.Controls[c];

                    if (ctrl.GetType() != typeof(GroupBox))
                        continue;

                    baseBox = (GroupBox)ctrl;
                    break;
                }
                int ix = 0;

                // evilHench1
                int cntx = -1;
                foreach (string hID in henchmenIds)
                {
                    LayEntity hench = SaveGamePlugin.LayFile.FindEntity(hID);
                    cntx++;
                    if (hench == null)
                    {
                        continue;
                    }
                    string henchName = henchNames[cntx];
                    EvilHenchControl ectrl = new EvilHenchControl();
                    tabHenchman.SuspendLayout();
                    tabHenchman.Controls.Add(ectrl);
                    ectrl.Tag = hID;
                    ectrl.Left = 0;
                    ectrl.Top = 0 + (ectrl.Height * ix);
                    ectrl.BringToFront();
                    ectrl.Text = henchName;
                    tabHenchman.ResumeLayout();
                    tabHenchman.PerformLayout();
                    tabHenchman.Refresh();
                    ix++;
                }

                foreach (string hID in henchmenIds)
                {
                    // See if we have the henchman
                    LayEntity hench = SaveGamePlugin.LayFile.FindEntity(hID);
                    if (hench == null)
                        found = false;
                    else
                        found = true;


                    for (int c = 0; c < tabHenchman.Controls.Count; c++)
                    {
                        Control ctrl = tabHenchman.Controls[c];

                        if (ctrl.GetType() != typeof(EvilHenchControl))
                            continue;

                        EvilHenchControl evilHench = (EvilHenchControl)ctrl;

                        GroupBox hBox = evilHench.groupBox2;

                        if ((string)evilHench.Tag == hID)
                        {
                            evilHench.Entity = hench;
                        }
                    }
                }
                #endregion


                #region Load regions tab
                string[] regionIds = new string[] { "1550", "1551", "1552", "1553", "1554" }; // TODO order alphabetical

                cntx = -1;
                ix = 0;
                int regHeight = lblTotalNotoriety.Height;

                foreach (string rID in regionIds)
                {
                    LayEntity region = SaveGamePlugin.LayFile.FindEntity(rID);
                    cntx++;
                    if (region == null)
                    {
                        continue;
                    }
                    EvilRegionControl ectrl = new EvilRegionControl();
                    tabRegions.SuspendLayout();
                    tabRegions.Controls.Add(ectrl);
                    ectrl.Tag = rID;
                    ectrl.Left = 0;
                    ectrl.Top = regHeight + (ectrl.Height * ix);
                    ectrl.BringToFront();
                    tabRegions.ResumeLayout();
                    tabRegions.PerformLayout();
                    tabRegions.Refresh();
                    m_Regions.Add(ectrl);
                    ix++;
                }

                foreach (string rID in regionIds)
                {
                    // See if we have the henchman
                    LayEntity region = SaveGamePlugin.LayFile.FindEntity(rID);
                    if (region == null)
                        found = false;
                    else
                        found = true;


                    for (int c = 0; c < tabRegions.Controls.Count; c++)
                    {
                        Control ctrl = tabRegions.Controls[c];

                        if (ctrl.GetType() != typeof(EvilRegionControl))
                            continue;

                        EvilRegionControl evilRegion = (EvilRegionControl)ctrl;


                        if ((string)evilRegion.Tag == rID)
                        {
                            evilRegion.Entity = region;
                        }
                    }
                }
                #endregion

            }
            catch (Exception ex)
            {
                lblStatus.Text = "Error loading saved game: " + ex.Message;
                tmrLoadProgress.Enabled = false;
                tabEditor.Enabled = false;
            }
        }
Exemplo n.º 9
0
        public LayMap(LayFile lf)
        {
            bool foundMap = false;

            string[] tempStrings;

            // Load the map
            for (int i = 0; i < lf.Properties.Count; i++)
            {
                LayProperty prop = lf.Properties[i];

                if (prop.Key == "GridDimensions")
                {
                    tempStrings = prop.Value.Explode(",");

                    if (tempStrings.Length != 2)
                    {
                        throw new Exception("Invalid map: size incorrect");
                    }


                    Size       = new Size(int.Parse(tempStrings[0]), int.Parse(tempStrings[1]));
                    Tiles      = new LayMapTile[Size.Width, Size.Height];
                    m_tmpTiles = new LayMapTile[Size.Width, Size.Height];
                    foundMap   = true;
                    continue;
                }

                if (!foundMap)
                {
                    continue;
                }

                if (prop.Key == "")
                {
                    continue;
                }

                if (prop.Key == "DynamicATNData")
                {
                    break;
                }
                m_Y++;

                string[] parts = prop.Key.Explode(",");

                m_X = 0;

                try
                {
                    foreach (string part in parts)
                    {
                        Tiles[m_X, m_Y]      = new LayMapTile(part, m_X, m_Y);
                        m_tmpTiles[m_X, m_Y] = Tiles[m_X, m_Y];

                        m_X++;

                        LayEntity le = lf.FindEntityByGridLocation(m_X - 1, m_Y);
                        if (le != null)
                        {
                            le.TilesGrid.Tiles.Add(Tiles[m_X - 1, m_Y]);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex = ex;
                }
                m_TileProperties.Add(prop);

                string mapPart = prop.Key;
                mapPart  = mapPart.Replace("20006A", "20000A");
                prop.Key = mapPart;
            }

            if (!foundMap)
            {
                throw new Exception("No map data found!");
            }

            for (int x = 0; x < Size.Width; x++)
            {
                for (int y = 0; y < Size.Height; y++)
                {
                    // Tiles[x, y] = m_tmpTiles[Size.Width - x - 1, y];       // something for later :P
                }
            }
        }
Exemplo n.º 10
0
 public LayMapTileGrid(LayEntity parentEntity)
 {
     m_ParentEntity = parentEntity;
 }