Пример #1
0
        private void SetSectionPositions(WindowSection section)
        {
            if (section.Items == null)
            {
                return;
            }

            if (section.Items.Count() == 0)
            {
                return;
            }

            var buttonHeight = section.Items.FirstOrDefault().Rectangle.Height;
            var buttonWidth  = section.Items.FirstOrDefault().Rectangle.Width;

            var x = 10;
            var y = (section.Area.Y) + 3;

            foreach (var button in section.Items)
            {
                button.Position = new Vector2(x, y);
                x += button.Rectangle.Width + 10;

                if ((x + button.Rectangle.Width) > (section.Area.Width) - 30)
                {
                    x  = 10;
                    y += buttonHeight + 10;
                }
            }
        }
Пример #2
0
        public TurnsWindow(GameModel gameModel)
            : base(gameModel)
        {
            Name = "Turns";

            var width  = 180;
            var height = gameModel.ScreenHeight - 80;

            Texture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, width, height);

            var outerTexture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, 20, height - 35 - 10);
            var innerTexture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, 14, 1);

            Helpers.SetTexture(Texture, new Color(43, 43, 43, 200), new Color(0, 0, 0, 200));
            Helpers.SetTexture(outerTexture, new Color(43, 43, 43), new Color(0, 0, 0));
            Helpers.SetTexture(innerTexture, new Color(69, 69, 69), new Color(0, 0, 0), 0);

            _section = new WindowSection()
            {
                Scrollbar = new Scrollbar(outerTexture, innerTexture)
                {
                    Layer = this.Layer + 0.01f,
                },
                Items = new List <Control>(),
            };
        }
 public bool CheckAgainstList(WindowSection value, List <WindowSection> toCheckAgainst)
 { // Checks to see if a value is in a list
     foreach (WindowSection windowSection in toCheckAgainst)
     {
         if (value.windows[0].transform.position == windowSection.windows[0].transform.position)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #4
0
    private void InitializeSections()
    {
        Texture2D sides = PIATextureDatabase.Instance.GetTexture("sides");

        sections  = new List <WindowSection>();
        header    = new WindowSection(new Rect(0, 0, position.width, 40), blackBarBGColor);
        leftSide  = new WindowSection(new Rect(0, header.GetRect().height, 220, position.height - header.GetRect().height), sides);
        rightSide = new WindowSection(new Rect(position.width - 220, header.GetRect().height, 220, position.height - header.GetRect().height), sides);
        body      = new WindowSection(new Rect(leftSide.GetRect().width, header.GetRect().height, position.width - leftSide.GetRect().width - rightSide.GetRect().width,
                                               position.height - header.GetRect().height), new Color(0.6275f, 0.6275f, 0.6275f, 1.0000f));

        sections.Add(header);
        sections.Add(leftSide);
        sections.Add(rightSide);
        sections.Add(body);
    }
Пример #5
0
        public TavernWindow(GameModel gameModel, List <ActorModel> actors)
            : base(gameModel)
        {
            _actors = actors;

            Name = "Tavern";

            var width  = gameModel.ScreenWidth - 20;
            var height = gameModel.ScreenHeight - 20 - 100;

            Texture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, width, height);

            var outerTexture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, 20, height - 35 - 10); // 35 is space at top, 10 is space at bottom
            var innerTexture = new Texture2D(_gameModel.GraphicsDeviceManager.GraphicsDevice, 14, 1);

            Helpers.SetTexture(Texture, new Color(43, 43, 43, 200), new Color(0, 0, 0, 200));
            Helpers.SetTexture(outerTexture, new Color(43, 43, 43), new Color(0, 0, 0));
            Helpers.SetTexture(innerTexture, new Color(69, 69, 69), new Color(0, 0, 0), 0);

            _leftSection = new WindowSection()
            {
                Scrollbar = new Scrollbar(outerTexture, innerTexture)
                {
                    Layer = this.Layer + 0.01f,
                },
                Items = new List <Control>(),
            };

            _rightSection = new WindowSection()
            {
                Scrollbar = new Scrollbar(outerTexture, innerTexture)
                {
                    Layer = this.Layer + 0.01f,
                },
                Items = new List <Control>(),
            };
        }
 public WindowRaycastNode(WindowSection section_, Vector3 pos_, RaycastType type_)
 {
     section = section_;
     pos     = pos_;
     type    = type_;
 }
Пример #7
0
        //Draw GUI
        public void OnGUI()
        {
            // Show message if in play mode
            if (EditorApplication.isPlaying)
            {
                GUILayout.Space(10);
                EditorGUILayout.LabelField(Content.PlaymodeError);
                return;
            }

            GUILayout.Space(10);
            EditorGUI.BeginChangeCheck();
            _avatar = (VRCAvatarDescriptor)EditorGUILayout.ObjectField(Content.Avatar, _avatar, typeof(VRCAvatarDescriptor), true);

            if (EditorGUI.EndChangeCheck())
            {
                _showContent = _avatar != null;
                if (_avatar != null)
                {
                    _avatar.customExpressions = true;
                    if (_avatar.expressionParameters == null)
                    {
                        GenerateNewExpressionParametersAsset();
                    }

                    if (_avatar.expressionsMenu == null)
                    {
                        GenerateNewExpressionMenuAsset();
                    }

                    UsedParameterMemory = _avatar.expressionParameters.CalcTotalCost();

                    _useDefaultParameters = _avatar.expressionParameters.FindParameter("VRCEmote") != null ||
                                            _avatar.expressionParameters.FindParameter("VRCFaceBlendH") != null ||
                                            _avatar.expressionParameters.FindParameter("VRCFaceBlendV") != null;

                    RefreshWDState();

                    RebuildLayers();
                }
            }

            if (!_showContent)
            {
                return;
            }

            if (_layers == null)
            {
                RebuildLayers();
            }

            GUILayout.Space(10);

            EditorGUILayout.HelpBox($"Parameters Memory used: {UsedParameterMemory}/{MAX_PARAMETER_COST}.", MessageType.None);
            if (UsedParameterMemory > MAX_PARAMETER_COST)
            {
                EditorGUILayout.HelpBox("You have too many parameters synced, untick the \"sync\" box of some parameters.", MessageType.Error);
            }

            if (_isMixedWriteDefaults)
            {
                EditorGUILayout.HelpBox("You have mixed Write Defaults in your layers, you may experience weird interactions ingame.", MessageType.Warning);
            }

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(Content.WdOff))
            {
                foreach (var layer in _layers.Where(x => !x.Layer.isDefault))
                {
                    AV3ManagerFunctions.SetWriteDefaults(layer.Controller, false);
                }
                RefreshWDState();
            }

            if (GUILayout.Button(Content.WdOn))
            {
                foreach (var layer in _layers.Where(x => !x.Layer.isDefault))
                {
                    AV3ManagerFunctions.SetWriteDefaults(layer.Controller, true);
                }
                RefreshWDState();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            _section = (WindowSection)GUILayout.Toolbar((int)_section, Enum.GetNames(typeof(WindowSection)), EditorStyles.toolbarButton, GUI.ToolbarButtonSize.Fixed);

            _mainScrollingPosition = EditorGUILayout.BeginScrollView(_mainScrollingPosition);

            switch (_section)
            {
            case WindowSection.Layers:
            {
                foreach (var l in _layers)
                {
                    GUILayout.Space(l.Index == _avatar.baseAnimationLayers.Length ? 50 : 10);
                    l.DrawLayerOptions();
                }

                break;
            }

            case WindowSection.Parameters:
            {
                DrawParametersTab();
                break;
            }
            }
            EditorGUILayout.EndScrollView();
        }
Пример #8
0
 private void OnEnable()
 {
     // INIT LAYOUTS
     body = new WindowSection(new Rect(bodyWorldOffset.x, bodyWorldOffset.y, position.width - bodyWorldOffset.x * 2,
                                       position.height - bodyWorldOffset.y * 2), new Color(0.6275f, 0.6275f, 0.6275f, 1.0000f));
 }