Пример #1
0
        private async void signIn_Click(object sender, RoutedEventArgs e)
        {
            signIn.IsEnabled = false;

            var i = new iNode(signInUser.Text, signInDom.Text.ToUpper(), signInPass.SecurePassword, currentImpersonation.depth + 1);

            if (await Task.Run((Func <bool>)i.start))
            {
                signInUser.Clear();
                signInPass.Clear();

                UserName       = i.name;
                UserDomainName = i.domain;

                i.parent = currentImpersonation;
                if (currentImpersonation.children == null)
                {
                    currentImpersonation.children = new List <iNode>();
                }
                currentImpersonation.children.Add(i);
                currentImpersonation = i;

                updateUserInfo();
                updateImpersonationTreeGUI();
            }

            signIn.IsEnabled = true;
        }
Пример #2
0
        public static void LastNode()
        {
            switch (CurrentNode.Type)
            {
            case NodeType.Sentence:

                iNode lastNode = CurrentNode.LastNode;
                if (lastNode.Type != NodeType.Sentence)
                {
                    return;
                }
                if (lastNode.Scene == CurrentScene)
                {
                    PlayNode(lastNode);
                }
                else
                {
                    PlayScene(lastNode.Scene);
                    PlayNode(lastNode);
                }
                break;

            case NodeType.Brunch:
                break;

            case NodeType.Option:
                break;

            case NodeType.End:
                break;

            default:
                break;
            }
        }
Пример #3
0
 public branchNode(string equation, iNode left, iNode right, bool state = false)
 {
     Equation   = equation;
     LeftChild  = left;
     RightChild = right;
     root       = state;
 }
Пример #4
0
        private void MenuItem_Generate_previews(object sender, RoutedEventArgs e)
        {
            var   _o   = (sender as MenuItem).DataContext;
            iNode node = _o as iNode;

            if (node != null)
            {
                node.createPreviews();
            }
        }
Пример #5
0
 public SystemInfo()
 {
     InitializeComponent();
     page                  = this;
     UserName              = Environment.UserName;
     UserDomainName        = Environment.UserDomainName;
     impersonationTreeRoot = new iNode(UserName, UserDomainName, null, 0);
     currentImpersonation  = impersonationTreeRoot;
     updateUserInfo();
     updateImpersonationTreeGUI();
 }
Пример #6
0
 private static void NextNode(iNode _next)
 {
     if (_next.Scene == CurrentScene)
     {
         PlayNode(_next);
     }
     else
     {
         PlayScene(_next.Scene);
         PlayNode(_next);
     }
 }
Пример #7
0
        static bool inspectNode(iNode node)
        {
            bool isOpen;

            if (node is ContainerNode parent)
            {
                isOpen = ImGui.TreeNodeEx($"{node}", ImGuiTreeNodeFlags.OpenOnArrow | ImGuiTreeNodeFlags.DefaultOpen);
            }
            else
            {
                isOpen = ImGui.TreeNodeEx($"{node}", ImGuiTreeNodeFlags.Leaf);
            }
            handleClick(node);
            return(isOpen);
        }
Пример #8
0
    private void PlayNodeTypeEnd(iNode _node)
    {
        PlayNodeTypeSentence(_node);
        GameManager.Save.Key.Add(_node.ID);
        var me = UIManager.GetUI<UI_Message>();
        me.Use(new UI_Message_Context()
        {
            Title = Writing.Get(100036),
            Message = System.Text.RegularExpressions.Regex.Unescape(Writing.Get(_node.Sentences.First().Value.DialogueID)),
            CallBack = ui =>
            {

            }
        });
        //UIManager.GetUI<UI_Game>().NoNext = true;
    }
Пример #9
0
        private void onSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            iNode node = e.NewValue as iNode;

            if (node == null)
            {
                return;
            }
            _props.SelectedObject = node;
            try
            {
                _preview_.Source = node.previews.FirstOrDefault();
            }
            catch (Exception)
            { }
            if (_preview_.Source == null)
            {
                return;
            }
            double _preview_ratio    = _preview_.Source.Width / _preview_.Source.Height;
            double _prev_panel_ratio = _prev_panel_.ActualWidth / _prev_panel_.ActualHeight;

            if (_preview_ratio >= _prev_panel_ratio)
            {
                if (_preview_ratio >= 1)
                {
                    _preview_.MaxWidth = _prev_panel_.ActualWidth;
                }
                else
                {
                    _preview_.MaxHeight = _prev_panel_.ActualHeight;
                }
            }
            else
            {
                if (_preview_ratio >= 1)
                {
                    _preview_.MaxHeight = _prev_panel_.ActualHeight;
                }
                else
                {
                    _preview_.MaxWidth = _prev_panel_.ActualWidth;
                }
            }
        }
Пример #10
0
        public void addChildToImpersonationTree(string name, string domain, string password)
        {
            // Convert string password to SecureString securePass.
            var securePass = new System.Net.NetworkCredential("", password).SecurePassword;

            // Create new node.
            var i = new iNode(name, domain, securePass, currentImpersonation.depth + 1);

            i.parent = currentImpersonation;

            // Add it as a child of the current node.
            if (currentImpersonation.children == null)
            {
                currentImpersonation.children = new List <iNode>();
            }
            currentImpersonation.children.Add(i);

            // Update the GUI.
            updateImpersonationTreeGUI();
        }
Пример #11
0
    public void Play(iNode _node)
    {
        switch (_node.Type)
        {
            case NodeType.Sentence:
                PlayNodeTypeSentence(_node);
                break;
            case NodeType.Brunch:
                PlayNodeTypeBrunch(_node);
                break;
            case NodeType.Option:
                PlayNodeTypeOption(_node);
                break;
            case NodeType.End:
                PlayNodeTypeEnd(_node);
                break;
            default:
                break;
        }

    }
Пример #12
0
 public static void PlayNode(iNode _node)
 {
     if (IsFinished && Player != null && _node != null)
     {
         if (_node.Scene != CurrentScene)
         {
             PlayScene(_node.Scene);
         }
         CurrentNode = _node;
         Player.Play(_node);
     }
     else if (Player != null)
     {
         Player.Loading();
     }
     else
     {
         ///没有播放器
         NoPlayer();
     }
 }
Пример #13
0
    private void PlayNodeTypeOption(iNode _node)
    {
        UIManager.GetUI<UI_Game>().NoNext = true;
        UI_Choice _c = UIManager.GetUI<UI_Choice>();
        _c.SetFront();

        UI_Choice_Context con = new UI_Choice_Context();
        con.OptionList = new List<iLabel>();
        foreach (var item in _node.Sentences)
        {
            Label l = new Label() { ID = item.Key, Name = Writing.Get(item.Value.DialogueID) };
            con.OptionList.Add(l);
        }

        con.Callback = (res, uichoice) =>
        {
            GameManager.Save.ChoiceResult[_node.ID] = res;
            uichoice.UseDone();
            Libretto.NextNode();
        };

        _c.Use(con);
    }
Пример #14
0
    private void PlayNodeTypeSentence(iNode _node)
    {
        ///背景处理
        if (!string.IsNullOrEmpty(_node.ChangeBGImage))
        {
            if (_node.ChangeBGImage == "Scene" )
            {
                background.Image.sprite = Loader.Sprite(Libretto.CurrentScene.BGImage);
            }
            else
            {
                background.Image.sprite = Loader.Sprite(_node.ChangeBGImage);
            }

        }

        if (!string.IsNullOrEmpty( _node.ChangeBGM))
        {
            if (_node.ChangeBGImage == "Scene")
            {
                background.Image.sprite = Loader.Sprite(Libretto.CurrentScene.BGAudio);
            }
            else
            {
                background.BGM.clip = Loader.AudioClip(_node.ChangeBGM);
            }
        }

        ///人物处理
        charactor.Play(_node.ActorList);

        ///台词处理

        captions.Play(_node.Sentences);

        UIManager.GetUI<UI_Game>().NoNext = false;
    }
Пример #15
0
 /// <summary>
 /// 结局处理
 /// </summary>
 /// <param name="currentScene"></param>
 /// <param name="currentNode"></param>
 private static void BrunchEnd(iScene currentScene, iNode currentNode)
 {
     NextNode(currentNode);
 }
Пример #16
0
        private FrameworkElement updateImpersonationTreeGUI(iNode node)
        {
            // add user info box
            var b = new Border
            {
                Background = Brushes.Transparent,
                Margin     = nodeMargin,
                Width      = nodeWidth
            };

            if (node == currentImpersonation)
            {
                b.SetResourceReference(Border.BackgroundProperty, "CurrentUserImpersonationNodeBackground");
            }

            // add click event handlers
            b.MouseLeftButtonDown += iNodeClick;
            b.StylusDown          += iNodeClick;
            b.TouchDown           += iNodeClick;

            // add hover event handlers
            b.MouseEnter  += iNodeHover;
            b.StylusEnter += iNodeHover;
            b.TouchEnter  += iNodeHover;
            b.MouseLeave  += iNodeUnhover;
            b.StylusLeave += iNodeUnhover;
            b.TouchLeave  += iNodeUnhover;

            // add this node to the element so we can get it easily later
            b.Tag = node;

            // add the user data
            var dataContainer = new StackPanel {
                Orientation = Orientation.Vertical
            };

            dataContainer.Children.Add(new TextBlock {
                Text = node.name
            });
            dataContainer.Children.Add(new TextBlock {
                Text = node.domain
            });
            b.Child = dataContainer;

            // if there are no children, return this
            if (node.children == null)
            {
                return(b);
            }

            /* WPF Layout
             * Grid with 5 rows and 2 * node.children columns
             *   - only the first row contents if there are no children
             *   first row
             *     Border
             *       StackPanel Vertical
             *         TextBlock UserName
             *         TextBlock Domain
             *   second row
             *     Rectangle 2px wide spanning all columns
             *   third row
             *     Border Right 2px
             *     Rectangle spanning 2 * children - 2 columns
             *     Border Left 2px
             *   fourth row
             *     Border Right
             *     Border LeftRight
             *     - repeat for children / 2
             *     Border Left
             *   fifth row
             *     - this is a child node
             */

            var ccount = node.children.Count;

            // create grid to hold lines and children
            var grid = new Grid();

            // add rows
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });

            // add columns
            for (var i = 0; i < ccount; ++i)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Auto
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Auto
                });
            }

            // add parent
            Grid.SetRow(b, 0);
            Grid.SetColumn(b, 0);
            Grid.SetColumnSpan(b, ccount * 2);
            grid.Children.Add(b);

            // add vertical line from parent
            var fromParent = new Rectangle {
                Width = 2, Height = verticalLineHeight
            };

            Grid.SetRow(fromParent, 1);
            Grid.SetColumn(fromParent, 0);
            Grid.SetColumnSpan(fromParent, ccount * 2);
            grid.Children.Add(fromParent);

            // add horizontal line
            var leftBorder = new Border {
                BorderThickness = borderRight, Height = 2
            };

            Grid.SetRow(leftBorder, 2);
            Grid.SetColumn(leftBorder, 0);
            grid.Children.Add(leftBorder);
            if (ccount > 1)
            {
                var column = new Rectangle();
                Grid.SetRow(column, 2);
                Grid.SetColumn(column, 1);
                Grid.SetColumnSpan(column, 2 * ccount - 2);
                grid.Children.Add(column);
            }
            var rightBorder = new Border {
                BorderThickness = borderLeft, Height = 2
            };

            Grid.SetRow(rightBorder, 2);
            Grid.SetColumn(rightBorder, 2 * ccount - 1);
            grid.Children.Add(rightBorder);

            // add vertical lines to children
            leftBorder = new Border {
                BorderThickness = borderRight, Height = verticalLineHeight
            };
            Grid.SetRow(leftBorder, 3);
            Grid.SetColumn(leftBorder, 0);
            grid.Children.Add(leftBorder);
            for (var i = 1; ccount > 1 && i <= ccount; i += 2)
            {
                var leftRightBorder = new Border {
                    BorderThickness = borderLeftRight, Height = verticalLineHeight
                };
                Grid.SetRow(leftRightBorder, 3);
                Grid.SetColumn(leftRightBorder, i);
                Grid.SetColumnSpan(leftRightBorder, 2);
                grid.Children.Add(leftRightBorder);
            }
            rightBorder = new Border {
                BorderThickness = borderLeft, Height = verticalLineHeight
            };
            Grid.SetRow(rightBorder, 3);
            Grid.SetColumn(rightBorder, 2 * ccount - 1);
            grid.Children.Add(rightBorder);

            // recursively add children
            for (var i = 0; i < ccount; ++i)
            {
                var child = updateImpersonationTreeGUI(node.children[i]);
                Grid.SetRow(child, 4);
                Grid.SetColumn(child, i * 2);
                Grid.SetColumnSpan(child, 2);
                grid.Children.Add(child);
            }

            return(grid);
        }
Пример #17
0
 private void PlayNodeTypeBrunch(iNode _node)
 {
     UIManager.GetUI<UI_Game>().NoNext = false;
     NextNode();
 }