Ejemplo n.º 1
0
        //ゲームの開始、終了、ロード時などのクリア処理
        void ClearSub(bool isStopSound)
        {
            Page.Clear();
            SelectionManager.Clear();
            BacklogManager.Clear();
            GraphicManager.Clear();
            GraphicManager.gameObject.SetActive(true);
            if (UiManager != null)
            {
                UiManager.Close();
            }

            ClearCustomCommand();
            ScenarioPlayer.Clear();
            if (isStopSound && SoundManager != null)
            {
                SoundManager.StopBgm();
                SoundManager.StopAmbience();
            }

            if (MessageWindowManager == null)
            {
                Debug.LogError("MessageWindowManager is Missing");
            }
            SaveManager.GetSaveIoListCreateIfMissing(this).ForEach(x => ((IAdvSaveData)x).OnClear());
            SaveManager.CustomSaveDataIOList.ForEach(x => ((IAdvSaveData)x).OnClear());
            OnClear.Invoke(this);
        }
Ejemplo n.º 2
0
    public bool Use()
    {
        List <GameObject> undoObjects = new List <GameObject>();

        if (selectionManager.selectedGameObjects.Count <= 0)
        {
            ISelectable iSelectable = SelectionManager.Instance.OnClickDown();

            if (iSelectable == null)
            {
                return(false);
            }
        }

        foreach (GameObject selectable in selectionManager.selectedGameObjects)
        {
            if (selectable.GetComponent <Face>())
            {
                GameObject block = selectable.transform.parent.gameObject;
                block.SetActive(false);
                undoObjects.Add(block);
            }
        }

        undoList.Add(undoObjects);
        redoList.Clear();
        selectionManager.Clear();

        return(true);
    }
        public override bool CanStartDrag(TreeViewItem targetItem, List<int> draggedItemIDs, Vector2 mouseDownPosition)
        {
            if (Event.current.modifiers != EventModifiers.None)
                return false;

            // Can only drag when starting in the track header area
            if (mouseDownPosition.x > m_Window.sequenceHeaderRect.xMax)
                return false;

            var trackBaseGUI = targetItem as TimelineTrackBaseGUI;

            if (trackBaseGUI == null || trackBaseGUI.track == null)
                return false;

            if (trackBaseGUI.track.lockedInHierarchy)
                return false;

            if (Event.current.type == EventType.MouseDrag && Mathf.Abs(Event.current.delta.y) < kDragSensitivity)
                return false;

            // Make sure dragged items are selected
            // TODO Use similar system than the SceneHierarchyWindow in order to handle selection between treeView and tracks.
            SelectionManager.Clear();
            var draggedTrackGUIs = m_Window.allTracks.Where(t => draggedItemIDs.Contains(t.id));
            foreach (var trackGUI in draggedTrackGUIs)
                SelectionManager.Add(trackGUI.track);

            return true;
        }
            public void ClearMultipleItemsWithMultiSelectEnabledAndFilledUpStart_ExistingItems(string scope)
            {
                var addedItems   = new List <int>();
                var removedItems = new List <int>();

                var selectionManager = new SelectionManager <int>
                {
                    AllowMultiSelect = true
                };

                selectionManager.Add(new[] { 4, 5, 6 }, scope);

                selectionManager.SelectionChanged += (sender, e) =>
                {
                    Assert.AreEqual(scope, e.Scope);

                    addedItems.AddRange(e.Added);
                    removedItems.AddRange(e.Removed);
                };

                selectionManager.Clear(scope);

                Assert.AreEqual(3, removedItems.Count);
                Assert.AreEqual(4, removedItems[0]);
                Assert.AreEqual(5, removedItems[1]);
                Assert.AreEqual(6, removedItems[2]);

                var selectedItems = selectionManager.GetSelectedItems(scope);

                Assert.AreEqual(0, selectedItems.Count);

                var selectedItem = selectionManager.GetSelectedItem(scope);

                Assert.AreEqual(0, selectedItem);
            }
 private void ResetSelections()
 {
     // Clear selections.
     _selectionManager.Clear();
     _currentState = new IdleState(_selectionManager, new Point(0, 0));
     RaiseStateChange();
 }
        private void OnRequestedCharacters(AckResponseCode responseCode, BaseAckMessage message)
        {
            var castedMessage = (ResponseCharactersMessage)message;

            SelectionManager.Clear();
            // Unenabled buttons
            buttonStart.gameObject.SetActive(false);
            buttonDelete.gameObject.SetActive(false);
            // Remove all models
            characterModelContainer.RemoveChildren();
            CharacterModels.Clear();

            var selectableCharacters = new List <PlayerCharacterData>();

            switch (responseCode)
            {
            case AckResponseCode.Error:
                var errorMessage = string.Empty;
                switch (castedMessage.error)
                {
                case ResponseCharactersMessage.Error.NotLoggedin:
                    errorMessage = "User not logged in";
                    break;
                }
                UISceneGlobal.Singleton.ShowMessageDialog("Cannot Load Characters", errorMessage);
                break;

            case AckResponseCode.Timeout:
                UISceneGlobal.Singleton.ShowMessageDialog("Cannot Load Characters", "Connection timeout");
                break;

            default:
                selectableCharacters = castedMessage.characters;
                break;
            }

            // Show list of created characters
            for (var i = selectableCharacters.Count - 1; i >= 0; --i)
            {
                var selectableCharacter = selectableCharacters[i];
                if (selectableCharacter == null || !GameInstance.PlayerCharacters.ContainsKey(selectableCharacter.DataId))
                {
                    selectableCharacters.RemoveAt(i);
                }
            }
            selectableCharacters.Sort(new PlayerCharacterDataLastUpdateComparer().Desc());
            CacheList.Generate(selectableCharacters, (index, character, ui) =>
            {
                var uiCharacter  = ui.GetComponent <UICharacter>();
                uiCharacter.Data = character;
                // Select trigger when add first entry so deactivate all models is okay beacause first model will active
                var characterModel            = character.InstantiateModel(characterModelContainer);
                CharacterModels[character.Id] = characterModel;
                characterModel.gameObject.SetActive(false);
                characterModel.SetEquipWeapons(character.EquipWeapons);
                characterModel.SetEquipItems(character.EquipItems);
                SelectionManager.Add(uiCharacter);
            });
        }
Ejemplo n.º 7
0
 void Clear()
 {
     Page.Clear();
     SelectionManager.Clear();
     BacklogManager.Clear();
     LayerManager.Clear();
     TransitionManager.Clear();
     if (UiManager != null)
     {
         UiManager.Close();
     }
 }
Ejemplo n.º 8
0
 public void Clear()
 {
     Page.Clear();
     SelectionManager.Clear();
     BacklogManager.Clear();
     GraphicManager.Clear();
     TransitionManager.Clear();
     if (UiManager != null)
     {
         UiManager.Close();
     }
     SoundManager.StopBgm();
     SoundManager.StopAmbience();
     ClearCustomCommand();
     ScenarioPlayer.Clear();
 }
Ejemplo n.º 9
0
        public TimelineTreeViewGUI(TimelineWindow sequencerWindow, TimelineAsset timeline, Rect rect)
        {
            this.m_Timeline = timeline;
            this.m_Window   = sequencerWindow;
            TreeViewState treeViewState = new TreeViewState();

            this.m_TreeView = new TreeViewController(sequencerWindow, treeViewState);
            this.m_TreeView.set_horizontalScrollbarStyle(GUIStyle.get_none());
            this.m_TimelineTreeView = new TimelineTreeView(sequencerWindow, this.m_TreeView);
            TimelineDragging timelineDragging = new TimelineDragging(this.m_TreeView, this.m_Window, this.m_Timeline);

            this.m_DataSource = new TimelineDataSource(this, this.m_TreeView, sequencerWindow);
            TimelineDataSource expr_7B = this.m_DataSource;

            expr_7B.onVisibleRowsChanged = (Action)Delegate.Combine(expr_7B.onVisibleRowsChanged, new Action(this.m_TimelineTreeView.CalculateRowRects));
            this.m_TreeView.Init(rect, this.m_DataSource, this.m_TimelineTreeView, timelineDragging);
            TreeViewController expr_C0 = this.m_TreeView;

            expr_C0.set_dragEndedCallback((Action <int[], bool>) Delegate.Combine(expr_C0.get_dragEndedCallback(), new Action <int[], bool>(delegate(int[] ids, bool value)
            {
                SelectionManager.Clear();
            })));
            this.m_DataSource.ExpandItems(this.m_DataSource.get_root());
        }
Ejemplo n.º 10
0
Archivo: Sketch.cs Proyecto: Daoting/dt
        /// <summary>
        /// 加载xml字符串
        /// </summary>
        /// <param name="p_xml"></param>
        public void ReadXml(string p_xml)
        {
            _his?.Clear();
            _container.Children.Clear();
            _selectionClerk.Clear();

            if (string.IsNullOrEmpty(p_xml))
            {
                return;
            }

            using (StringReader stream = new StringReader(p_xml))
                using (XmlReader reader = XmlReader.Create(stream, new XmlReaderSettings()
                {
                    IgnoreWhitespace = true, IgnoreComments = true, IgnoreProcessingInstructions = true
                }))
                {
                    reader.Read();

                    Rect totalRect = new Rect();
                    bool isFirst   = true;
                    reader.Read();
                    while (reader.NodeType != XmlNodeType.None)
                    {
                        if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Sketch")
                        {
                            break;
                        }

                        Rect   rc   = new Rect();
                        string name = reader.Name;
                        if (name == "Node")
                        {
                            SNode node = new SNode(this);
                            _container.Children.Add(node);
                            node.ReadXml(reader);
                            rc = new Rect(Canvas.GetLeft(node), Canvas.GetTop(node), node.Width, node.Height);
                        }
                        else if (name == "Line")
                        {
                            SLine line = new SLine(this);
                            _container.Children.Add(line);
                            line.ReadXml(reader);
                            rc = line.Bounds;
                        }
                        else if (name == "Txt")
                        {
                            TextBlock tb = new TextBlock();
                            _container.Children.Add(tb);
                            for (int i = 0; i < reader.AttributeCount; i++)
                            {
                                reader.MoveToAttribute(i);
                                switch (reader.Name)
                                {
                                case "text": tb.Text = reader.Value; break;

                                case "fontsize": tb.FontSize = double.Parse(reader.Value); break;

                                    // uwp和手机系统weight的操作方式不同
#if UWP
                                case "fontweight": tb.FontWeight = new FontWeight()
                                {
                                        Weight = ushort.Parse(reader.Value)
                                }; break;
#else
                                case "fontweight": tb.FontWeight = new FontWeight(ushort.Parse(reader.Value)); break;
#endif
                                case "foreground": tb.Foreground = new SolidColorBrush(Res.HexStringToColor(reader.Value)); break;

                                case "fontstyle": tb.FontStyle = (FontStyle)int.Parse(reader.Value); break;

                                case "fontfamily": tb.FontFamily = new FontFamily(reader.Value); break;

                                case "left": Canvas.SetLeft(tb, double.Parse(reader.Value)); break;

                                case "top": Canvas.SetTop(tb, double.Parse(reader.Value)); break;

                                case "width": tb.Width = double.Parse(reader.Value); break;

                                case "height": tb.Height = double.Parse(reader.Value); break;
                                }
                            }
                            rc = new Rect(Canvas.GetLeft(tb), Canvas.GetTop(tb), tb.Width, tb.Height);
                        }

                        if (isFirst)
                        {
                            totalRect = rc;
                            isFirst   = false;
                        }
                        else
                        {
                            totalRect = Union(totalRect, rc);
                        }

                        reader.Read();
                    }

                    if (IsReadOnly)
                    {
                        ResizeReadOnlyPage(totalRect);
                    }
                    else
                    {
                        ResizeEditPage(totalRect);
                    }
                }
            RefreshAllLines();
        }