/// <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);
                }
            }
Exemplo n.º 2
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");
                    }
                }
            }
Exemplo n.º 3
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;
        }
            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);
            }
Exemplo n.º 5
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);
                }
            }
Exemplo n.º 6
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");
                    }
                }
            }
Exemplo n.º 7
0
        void InterfaceCommandHandler(ITextBuilder responseBuilder)
        {
            //
            // Add Interface Definitions
            //
            foreach (NpcInterfaceInfo interfaceInfo in npcExecutor.Interfaces)
            {
                responseBuilder.AppendAscii(interfaceInfo.name);
                for (int i = 0; i < interfaceInfo.parentNpcInterfaces.Count; i++)
                {
                    NpcInterfaceInfo parentNpcInterface = interfaceInfo.parentNpcInterfaces[i];
                    responseBuilder.AppendAscii(' ');
                    responseBuilder.AppendAscii(parentNpcInterface.name);
                }
                responseBuilder.AppendAscii('\n');

                for (int i = 0; i < interfaceInfo.npcMethods.Length; i++)
                {
                    NpcMethodInfo npcMethodInfo = interfaceInfo.npcMethods[i];
#if WindowsCE
                    responseBuilder.Append(npcMethodInfo.methodInfo.ReturnType.SosTypeName());
#else
                    responseBuilder.AppendAscii(npcMethodInfo.methodInfo.ReturnParameter.ParameterType.SosTypeName());
#endif
                    responseBuilder.AppendAscii(' ');
                    responseBuilder.AppendAscii(npcMethodInfo.methodName);

                    responseBuilder.AppendAscii('(');

                    ParameterInfo[] parameters = npcMethodInfo.parameters;
                    for (UInt16 j = 0; j < npcMethodInfo.parametersLength; j++)
                    {
                        ParameterInfo parameterInfo = parameters[j];
                        if (j > 0)
                        {
                            responseBuilder.AppendAscii(',');
                        }
                        responseBuilder.AppendAscii(parameterInfo.ParameterType.SosTypeName());
                        responseBuilder.AppendAscii(' ');
                        responseBuilder.AppendAscii(parameterInfo.Name);
                    }
                    responseBuilder.AppendAscii(")\n");
                }
                responseBuilder.AppendAscii('\n');
            }
            responseBuilder.AppendAscii('\n'); // Add blank line to end (to mark end of interfaces)

            //
            // Add Object Names and their Interfaces
            //
            foreach (NpcExecutionObject executionObject in npcExecutor.ExecutionObjects)
            {
                responseBuilder.AppendAscii(executionObject.objectName);
                for (int i = 0; i < executionObject.parentNpcInterfaces.Count; i++)
                {
                    NpcInterfaceInfo npcInterface = executionObject.parentNpcInterfaces[i];
                    responseBuilder.AppendAscii(' ');
                    responseBuilder.AppendAscii(npcInterface.name);
                }
                responseBuilder.AppendAscii('\n');
            }
            responseBuilder.AppendAscii('\n'); // Add blank line to end (to mark end of objects
        }
Exemplo n.º 8
0
        public void GenerateMethodsPage(ITextBuilder htmlBuilder)
        {
            htmlBuilder.AppendAscii("<div class=\"methodgroups\">");

            Int32 tabIndex = 1;

            foreach (NpcExecutionObject executionObject in npcExecutor.ExecutionObjects)
            {
                htmlBuilder.AppendAscii("<div class=\"methods\"><hr/><h2>");
                htmlBuilder.AppendAscii(executionObject.objectName);
                htmlBuilder.AppendAscii("</h2><hr/>");

                for (int interfaceIndex = 0; interfaceIndex < executionObject.ancestorNpcInterfaces.Count; interfaceIndex++)
                {
                    NpcInterfaceInfo interfaceInfo = executionObject.ancestorNpcInterfaces[interfaceIndex];
                    for (int methodIndex = 0; methodIndex < interfaceInfo.npcMethods.Length; methodIndex++)
                    {
                        NpcMethodInfo npcMethodInfo = interfaceInfo.npcMethods[methodIndex];

                        ParameterInfo[] parameters     = npcMethodInfo.parameters;
                        Int32           parameterCount = (parameters == null) ? 0 : parameters.Length;

                        //htmlBuilder.AppendFormat("<form class=\"methodform\" action=\"call/{0}.{1}\" method=\"get\">", executionObject.objectName, npcMethodInfo.methodName);
                        htmlBuilder.AppendAscii("<form class=\"methodform\" action=\"call/");
                        htmlBuilder.AppendAscii(executionObject.objectName);
                        htmlBuilder.AppendAscii(".");
                        htmlBuilder.AppendAscii(npcMethodInfo.methodName);
                        htmlBuilder.AppendAscii("\" method=\"get\">");

                        //htmlBuilder.AppendFormat("<input class=\"executebutton\" type=\"submit\" value=\"Execute\" tabindex=\"{0}\"/>", tabIndex + parameterCount);
                        htmlBuilder.AppendAscii("<input class=\"executebutton\" type=\"submit\" value=\"Execute\" tabindex=\"");
                        htmlBuilder.AppendNumber(tabIndex + parameterCount);
                        htmlBuilder.AppendAscii("\"/>");
#if WindowsCE
                        htmlBuilder.Append(TypeAsHtml(npcMethodInfo.methodInfo.ReturnType));
#else
                        htmlBuilder.AppendAscii(TypeAsHtml(npcMethodInfo.methodInfo.ReturnParameter.ParameterType));
#endif

                        //htmlBuilder.AppendFormat("&nbsp;<font class=\"bold\">{0}</font>(", npcMethodInfo.methodInfo.Name);
                        htmlBuilder.AppendAscii("&nbsp;<font class=\"bold\">");
                        htmlBuilder.AppendAscii(npcMethodInfo.methodInfo.Name);
                        htmlBuilder.AppendAscii("</font>(");
                        if (parameterCount > 0)
                        {
                            htmlBuilder.AppendAscii("<div style=\"padding-left:50px;\"><table class=\"methodtable\">");
                            for (UInt16 j = 0; j < parameterCount; j++)
                            {
                                ParameterInfo parameterInfo = parameters[j];
                                //htmlBuilder.AppendFormat("<tr><td>{0}</td><td>&nbsp;{1}</td><td>&nbsp;=&nbsp;</td><td width=\"100%\"><input style=\"width:100%;\" tabindex=\"{3}\" name=\"{2}\"/></td></tr>",
                                //    TypeAsHtml(parameterInfo.ParameterType), parameterInfo.Name, j, tabIndex++);
                                htmlBuilder.AppendAscii("<tr><td>");
                                htmlBuilder.AppendAscii(TypeAsHtml(parameterInfo.ParameterType));
                                htmlBuilder.AppendAscii("</td><td>&nbsp;");
                                htmlBuilder.AppendAscii(parameterInfo.Name);
                                htmlBuilder.AppendAscii("</td><td>&nbsp;=&nbsp;</td><td width=\"100%\"><input style=\"width:100%;\" tabindex=\"");
                                htmlBuilder.AppendNumber(tabIndex++);
                                htmlBuilder.AppendAscii("\" name=\"");
                                htmlBuilder.AppendNumber(j);
                                htmlBuilder.AppendAscii("\"/></td></tr>");
                            }
                            htmlBuilder.AppendAscii("</table></div>");
                        }
                        htmlBuilder.AppendAscii(")</form>");
                    }
                }
                tabIndex++;
                htmlBuilder.AppendAscii("</div>");
            }

            htmlBuilder.AppendAscii("</div>");

            htmlBuilder.AppendAscii("<div id=\"executeframe\"></div>");
        }