예제 #1
0
        protected override void Layout()
        {
            if ((MenuState & QuickActionMenuState.ListMenuOpen) > 0)
            {
                Size = propertyList.Size;
            }
            else
            {
                Size = propertyWheel.Size;
            }

            if (DrawDebug && textUpdateTick == 0)
            {
                ITextBuilder debugBuilder = debugText.TextBoard;
                debugBuilder.Clear();
                debugBuilder.Append($"ConObj: {MyAPIGateway.Session.ControlledObject.GetType().Name}\n");
                debugBuilder.Append($"SpecCam: {LocalPlayer.IsSpectating}\n");
                debugBuilder.Append($"State: {MenuState}\n");
                debugBuilder.Append($"Wheel Menu Open: {propertyWheel.IsOpen}\n");
                debugBuilder.Append($"IsWidgetOpen: {propertyWheel.IsWidgetOpen}\n");
                debugBuilder.Append($"List Menu Open: {propertyList.IsOpen}\n");
                debugBuilder.Append($"Cursor Mode: {HudMain.InputMode}\n");
                debugBuilder.Append($"Blacklist Mode: {BindManager.BlacklistMode}\n");
                debugBuilder.Append($"Enable Cursor Pressed: {BvBinds.MultXOrMouse.IsPressed}\n");
            }

            debugText.Visible = DrawDebug;

            textUpdateTick++;
            textUpdateTick %= textTickDivider;
        }
            /// <summary>
            /// Updates associated text label for the entry in the menu
            /// </summary>
            public void UpdateText(bool selected)
            {
                StringBuilder name = BlockMember.Name,
                              disp = BlockMember.FormattedValue;
                ITextBuilder tb    = Element.TextBoard;

                var fmtName  = selected ? selectedFormatCenter : nameFormatCenter;
                var fmtValue = selected ? selectedFormatCenter : valueFormatCenter;

                tb.Clear();

                if (name != null)
                {
                    textBuf.Clear();
                    textBuf.AppendSubstringMax(name, maxEntryCharCount);

                    if (disp != null)
                    {
                        textBuf.Append(":\n");
                    }

                    tb.Append(textBuf, fmtName);
                }

                if (disp != null)
                {
                    textBuf.Clear();
                    textBuf.AppendSubstringMax(disp, maxEntryCharCount);

                    tb.Append(textBuf, fmtValue);
                }
            }
예제 #3
0
            private void UpdateDebugText()
            {
                PropertyWheelEntryBase selection = activeWheel?.Selection;

                if (selection != null)
                {
                    var          propertyEntry = selection as PropertyWheelEntry;
                    ITextBuilder textBuilder   = debugText.TextBoard;
                    textBuilder.Clear();

                    textBuilder.Append($"Prioritized Members: {Target.Prioritizer.PrioritizedMemberCount}\n");
                    textBuilder.Append($"Enabled Members: {Target.EnabledMemberCount}\n");
                    textBuilder.Append($"Selection: {selection.Element.TextBoard}\n");

                    if (propertyEntry != null)
                    {
                        textBuilder.Append($"ID: {propertyEntry.BlockMember.PropName}\n");
                        textBuilder.Append($"Type: {propertyEntry.BlockMember.GetType().Name}\n");
                        textBuilder.Append($"Entry Enabled: {propertyEntry.Enabled}\n");
                        textBuilder.Append($"Prop Enabled: {propertyEntry.BlockMember.Enabled}\n");
                        textBuilder.Append($"Value Text: {propertyEntry.BlockMember.ValueText}\n");
                        textBuilder.Append($"Is Duplicating: {propertyEntry.IsSelectedForDuplication}\n");
                    }
                }
            }
예제 #4
0
        public void CallCommandHandler(ITextBuilder responseBuilder, String methodName, String arguments)
        {
            //
            // Parse Parameters
            //
            List <String> parametersList = new List <String>();

            try
            {
                Npc.ParseParameters(arguments, parametersList);
            }
            catch (FormatException e)
            {
                callback.GotInvalidData(clientString, e.Message);
                AppendNpcError(responseBuilder, NpcErrorCode.InvalidCallParameters, e.Message);
                return;
            }

            String[] parameters = (parametersList == null) ? null : parametersList.ToArray();
            try
            {
                NpcReturnObjectOrException returnObject = npcExecutor.ExecuteWithStrings(methodName, parameters);
                if (returnObject.exception != null)
                {
                    callback.FunctionCallThrewException(clientString, methodName, returnObject.exception);
                }
                else
                {
                    callback.FunctionCall(clientString, methodName);
                }

                returnObject.AppendNpcReturnLine(responseBuilder);
                return;
            }
            catch (NpcErrorException ne)
            {
                callback.ExceptionDuringExecution(clientString, methodName, ne);
                responseBuilder.Clear();
                AppendNpcError(responseBuilder, ne.errorCode, ne.Message);
            }
            catch (Exception e)
            {
                callback.ExceptionDuringExecution(clientString, methodName, e);
                responseBuilder.Clear();
                AppendNpcError(responseBuilder, NpcErrorCode.UnhandledException, e.GetType().Name + ": " + e.Message);
            }
        }
            private void UpdateText()
            {
                IPropertyBlock block = propertyWheelMenu.quickActionMenu.Target;

                summaryBuilder.Clear();
                summaryBuilder.Add("Build Vision\n", wheelHeaderFormat);
                block.GetSummary(summaryBuilder, bodyFormatCenter, bodyValueFormatCenter);

                ITextBuilder notificationBuidler = notificationText.TextBoard;

                if (notification != null && notificationTimer.ElapsedMilliseconds < notificationTime)
                {
                    notificationBuidler.Clear();
                    notificationBuidler.Append("\n", bodyFormatCenter);
                    notificationBuidler.Append(notification, bodyValueFormatCenter);

                    if (contNotification)
                    {
                        notification     = null;
                        contNotification = false;
                    }
                }
                else if ((MenuState & QuickActionMenuState.PropertyDuplication) > 0)
                {
                    textBuf.Clear();
                    textBuf.Append("Copying ");
                    textBuf.Append(block.Duplicator.GetSelectedEntryCount());
                    textBuf.Append(" of ");
                    textBuf.Append(block.Duplicator.GetValidEntryCount());
                    notificationBuidler.SetText(textBuf, bodyValueFormatCenter);
                }
                else
                {
                    notification = null;
                    notificationBuidler.Clear();
                    var target = propertyWheelMenu.quickActionMenu.Target;

                    if (!target.IsFunctional)
                    {
                        notificationBuidler.SetText("[Incomplete]", blockIncFormat.WithAlignment(TextAlignment.Center));
                    }
                }

                summaryLabel.TextBoard.SetText(summaryBuilder);
            }
예제 #6
0
            protected override void Layout()
            {
                base.Layout();

                if (!sliderBox.IsTextInputOpen)
                {
                    ITextBuilder valueBuilder = sliderBox.ValueBuilder;
                    valueBuilder.Clear();

                    if (floatMember.StatusText != null && floatMember.StatusText.Length > 0)
                    {
                        valueBuilder.Append(floatMember.StatusText, wheelValueColor);
                        valueBuilder.Append(" ");
                    }

                    valueBuilder.Append(floatMember.FormattedValue, wheelNameColor);
                }
            }
예제 #7
0
            private void UpdateDebugText()
            {
                ITextBuilder textBuilder = debugText.TextBoard;

                textBuilder.Clear();
                textBuilder.Append($"Selection: {listBody[selectionIndex].NameText}\n");
                textBuilder.Append($"ID: {listBody[selectionIndex].AssocMember.PropName}\n");
                textBuilder.Append($"Type: {listBody[selectionIndex].AssocMember.GetType().Name}\n");
                textBuilder.Append($"Value Text: {listBody[selectionIndex].AssocMember.ValueText}\n");
                textBuilder.Append($"Open: {listBody[selectionIndex].PropertyOpen}\n");
                textBuilder.Append($"Is Duplicating: {listBody[selectionIndex].IsSelectedForDuplication}\n");

                if (listBody[selectionIndex].AssocMember is IBlockComboBox)
                {
                    var member = listBody[selectionIndex].AssocMember as IBlockComboBox;
                    textBuilder.Append($"Value: {member.Value}\n");

                    for (int i = 0; i < member.ComboEntries.Count; i++)
                    {
                        textBuilder.Append($"Entry {member.ComboEntries[i].Key}: {member.ComboEntries[i].Value}\n");
                    }
                }
            }