Exemplo n.º 1
0
        // Use this for initialization
        void OnEnable()
        {
            SelectionManager.Current.SetSelectionChangeAction(SelectMarkers);

            int[] Types;
            SelectionManager.Current.SetAffectedGameObjects(MarkersControler.GetMarkerObjects(out Types), SelectionManager.SelectionControlTypes.MarkerChain);
            SelectionManager.Current.SetAffectedTypes(Types);
            //Selection.SelectionManager.Current.SetCustomSettings(true, false, false);
            //ChainSelected = -1;

            UpdateList();
        }
Exemplo n.º 2
0
        public void GoToSelection()
        {
            if (!MarkersInfo.MarkerPageChange)
            {
                SelectionManager.Current.CleanSelection();
            }

            int[] Types;
            SelectionManager.Current.SetAffectedGameObjects(MarkersControler.GetMarkerObjects(out Types), SelectionManager.SelectionControlTypes.Marker);
            SelectionManager.Current.SetAffectedTypes(Types);
            //Selection.SelectionManager.Current.SetCustomSettings(true, false, false);


            PlacementManager.Clear();
            if (ChangeControlerType.Current)
            {
                ChangeControlerType.Current.UpdateButtons();
            }

            MarkerSelectionOptions.UpdateOptions();
        }
Exemplo n.º 3
0
        public void DestroyMarkers(List <GameObject> MarkerObjects, bool RegisterUndo = true)
        {
            int  mc         = 0;    // MasterChainID
            bool AnyRemoved = false;
            int  Mcount     = MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers.Count;

            if (RegisterUndo)
            {
                LastDestroyedMarkers = new int[MarkerObjects.Count];
                int Step = 0;
                for (int i = 0; i < Mcount; i++)
                {
                    //bool Removed = false;
                    for (int m = 0; m < MarkerObjects.Count; m++)
                    {
                        if (MarkerObjects[m] == null)
                        {
                            break;
                        }

                        if (MarkerObjects[m] == MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i].MarkerObj.gameObject)
                        {
                            LastDestroyedMarkers[Step] = i;
                            Step++;
                            break;
                        }
                    }
                }

                Undo.Current.RegisterMarkersRemove();
            }

            //List<MapLua.SaveLua.Marker> NewMarkers = new List<MapLua.SaveLua.Marker>();

            //Mcount = MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers.Count;

            for (int i = 0; i < Mcount; i++)
            {
                if (MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i].MarkerObj == null)
                {
                    continue;
                }

                //bool Removed = false;
                for (int m = 0; m < MarkerObjects.Count; m++)
                {
                    if (MarkerObjects[m] == MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i].MarkerObj.gameObject)
                    {
                        MapLua.SaveLua.RemoveMarker(MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i].Name);
                        Destroy(MarkerObjects[m]);
                        MarkerObjects.RemoveAt(m);
                        MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i] = null;
                        MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers.RemoveAt(i);
                        Mcount--;
                        i--;
                        AnyRemoved = true;
                        break;
                    }
                }

                //if (!Removed)
                //	NewMarkers.Add(MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[i]);
            }

            //MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers = NewMarkers.ToArray();
            if (AnyRemoved)
            {
                SelectionManager.Current.CleanSelection();
                int[] Types;
                SelectionManager.Current.SetAffectedGameObjects(MarkersControler.GetMarkerObjects(out Types), SelectionManager.SelectionControlTypes.Marker);
                SelectionManager.Current.SetAffectedTypes(Types);
                MarkerSelectionOptions.UpdateOptions();

                RenderMarkersConnections.Current.UpdateConnections();
            }
        }