Beispiel #1
0
    public bool zone_activated(int x, int y)
    {
        SDKZone szone = Zones.Find(zone => zone.X == x && zone.Y == y);

        if (szone == null)
        {
            szone = new SDKZone(x, y);
            Zones.Add(szone);
        }

        if (CurrentZone != null)
        {
            SetZone(CurrentZone, false);
        }
        SetZone(szone, true);
        CurrentZone = szone;

        cmbShowChance.Enabled  = true;
        cmbShowTable.Enabled   = true;
        cmbShowTerrain.Enabled = true;

        //ScriptGlobal.SetSelectedZone(x, y);
        RefreshWorldMap();

        return(true);
    }
Beispiel #2
0
 void IfSetModified(SDKZone zone, string str1, string str2)
 {
     if (str1 != str2)
     {
         //MessageBox.Show("modified");
         zone.Modified = true;
     }
 }
Beispiel #3
0
    private List <SDKZone> LoadZones(string FileName)
    {
        List <SDKZone> Zones = new List <SDKZone>();

        try
        {
            List <string> lines = new List <string>(File.ReadAllLines(FileName));

            string version;
            if (!WorldMapUtils.VerifyFormat(lines[0], FileName, "SDK", out version))
            {
                return(null);
            }

            foreach (string line in lines)
            {
                if (line.Length == 0 || (line.Contains("Format") && line.Contains("Version")))
                {
                    continue;
                }

                String[] SplittedLine = line.Split('|');
                String[] Coords       = SplittedLine[0].Split(',');
                String[] Parameters   = SplittedLine[1].Split(',');

                SDKZone zone = new SDKZone(Int32.Parse(Coords[0]), Int32.Parse(Coords[1]));
                zone.Table   = Parameters[0];
                zone.Terrain = Parameters[1];
                zone.Fill    = Parameters[2];
                zone.Chance  = Parameters[3];
                Zones.Add(zone);
            }
        }
        catch (FileNotFoundException)
        {
            WorldEditor.Message.Show("Couldn't open " + FileName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(null);
        }
        catch (Exception e)
        {
            WorldEditor.Message.Show("Exception occured: " + e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(null);
        }
        return(Zones);
    }
Beispiel #4
0
    void SetZone(SDKZone zone, bool ToUI)
    {
        if (ToUI)
        {
            cmbChance.Enabled  = true;
            cmbTerrain.Enabled = true;
            cmbTable.Enabled   = true;

            cmbChance.Text  = zone.Chance;
            cmbTable.Text   = zone.Table;
            cmbTerrain.Text = zone.Terrain;
        }
        else
        {
            IfSetModified(zone, zone.Chance, cmbChance.Text);
            IfSetModified(zone, zone.Table, cmbTable.Text);
            IfSetModified(zone, zone.Terrain, cmbTerrain.Text);
            zone.Chance  = cmbChance.Text;
            zone.Table   = cmbTable.Text;
            zone.Terrain = cmbTerrain.Text;
        }
    }
Beispiel #5
0
    void SetZone(SDKZone zone, bool ToUI)
    {
        if (ToUI)
        {
            cmbChance.Enabled = true;
            cmbTerrain.Enabled = true;
            cmbTable.Enabled = true;

            cmbChance.Text = zone.Chance;
            cmbTable.Text = zone.Table;
            cmbTerrain.Text = zone.Terrain;
        }
        else
        {
            IfSetModified(zone, zone.Chance, cmbChance.Text);
            IfSetModified(zone, zone.Table, cmbTable.Text);
            IfSetModified(zone, zone.Terrain, cmbTerrain.Text);
            zone.Chance = cmbChance.Text;
            zone.Table = cmbTable.Text;
            zone.Terrain = cmbTerrain.Text;
        }
    }
Beispiel #6
0
    private List<SDKZone> LoadZones(string FileName)
    {
        List<SDKZone> Zones = new List<SDKZone>();
        try
        {
            List<string> lines = new List<string>(File.ReadAllLines(FileName));

            string version;
            if (!WorldMapUtils.VerifyFormat(lines[0], FileName, "SDK", out version))
                return null;

            foreach (string line in lines)
            {
                if (line.Length == 0 || (line.Contains("Format") && line.Contains("Version")))
                    continue;

                String[] SplittedLine = line.Split('|');
                String[] Coords = SplittedLine[0].Split(',');
                String[] Parameters = SplittedLine[1].Split(',');

                SDKZone zone = new SDKZone(Int32.Parse(Coords[0]), Int32.Parse(Coords[1]));
                zone.Table = Parameters[0];
                zone.Terrain = Parameters[1];
                zone.Fill = Parameters[2];
                zone.Chance = Parameters[3];
                Zones.Add(zone);
            }
        }
        catch (FileNotFoundException)
        {
            WorldEditor.Message.Show("Couldn't open " + FileName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return null;
        }
        catch (Exception e)
        {
            WorldEditor.Message.Show("Exception occured: " + e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return null;
        }
        return Zones;
    }
Beispiel #7
0
 void IfSetModified(SDKZone zone, string str1, string str2)
 {
     if (str1 != str2)
     {
         //MessageBox.Show("modified");
         zone.Modified = true;
     }
 }
Beispiel #8
0
    public bool zone_activated(int x, int y)
    {
        SDKZone szone = Zones.Find(zone => zone.X == x && zone.Y == y);
        if (szone == null)
        {
            szone = new SDKZone(x, y);
            Zones.Add(szone);
        }

        if (CurrentZone != null)
            SetZone(CurrentZone, false);
        SetZone(szone, true);
        CurrentZone = szone;

        cmbShowChance.Enabled = true;
        cmbShowTable.Enabled = true;
        cmbShowTerrain.Enabled = true;

        //ScriptGlobal.SetSelectedZone(x, y);
        RefreshWorldMap();

        return true;
    }