Ejemplo n.º 1
0
    public void AddNew()
    {
        Undo.Current.RegisterAreasChange();

        List <MapLua.SaveLua.Areas> Areas = MapLuaParser.Current.SaveLuaFile.Data.areas.ToList();

        MapLua.SaveLua.Areas NewArea = new MapLua.SaveLua.Areas();

        string DefaultMapArea = "New Area";
        int    NextAreaName   = 0;
        bool   FoundGoodName  = false;

        while (!FoundGoodName)
        {
            FoundGoodName = true;
            string TestName = DefaultMapArea + ((NextAreaName > 0) ? (" " + NextAreaName.ToString()) : (""));
            for (int i = 0; i < MapLuaParser.Current.SaveLuaFile.Data.areas.Length; i++)
            {
                if (MapLuaParser.Current.SaveLuaFile.Data.areas[i].Name == TestName)
                {
                    FoundGoodName = false;
                    NextAreaName++;
                    break;
                }
            }
        }

        NewArea.Name      = DefaultMapArea + ((NextAreaName > 0)?(" " + NextAreaName.ToString()) :(""));
        NewArea.rectangle = new Rect(0, 0, ScmapEditor.Current.map.Width, ScmapEditor.Current.map.Height);
        Areas.Add(NewArea);

        MapLuaParser.Current.SaveLuaFile.Data.areas = Areas.ToArray();
        UpdateList();
    }
Ejemplo n.º 2
0
    public void ToggleSelected()
    {
        HideArea = AreaHide.isOn;

        if (AreaHide.isOn || AreaDefault.isOn)
        {
            SelectedArea = null;
        }
        MapLuaParser.Current.UpdateArea(Rounding.isOn);
    }
Ejemplo n.º 3
0
    public void Remove(int instanceID)
    {
        Undo.Current.RegisterAreasChange();

        if (SelectedArea == MapLuaParser.Current.SaveLuaFile.Data.areas[instanceID])
        {
            SelectedArea     = null;
            AreaDefault.isOn = true;
        }

        List <MapLua.SaveLua.Areas> Areas = MapLuaParser.Current.SaveLuaFile.Data.areas.ToList();

        Areas.RemoveAt(instanceID);

        MapLuaParser.Current.SaveLuaFile.Data.areas = Areas.ToArray();


        UpdateList();
    }
Ejemplo n.º 4
0
 public void SelectArea(int InstanceID)
 {
     SelectedArea = MapLuaParser.Current.SaveLuaFile.Data.areas[InstanceID];
     MapLuaParser.Current.UpdateArea(Rounding.isOn);
 }
Ejemplo n.º 5
0
 public void RegisterAreaChange(MapLua.SaveLua.Areas Area)
 {
     HistoryAreaChange.CurrentArea = Area;
     HistoryAreaChange.GenerateUndo(Prefabs.AreaChange).Register();
 }