static void testLabel() { Separate(); Console.WriteLine(" Test Label class"); Separate(); UINode.UIRoot.Clear(); Label label1 = new Label("1234", "Label style", "label1"); Console.WriteLine("\n Create new label and add it to root\n"); UINode.UIRoot.Add(label1); Console.WriteLine("\n Try to add child to label\n"); Console.WriteLine("add node: {0}", label1.Add(new UINode())); Console.WriteLine("add label: {0}", label1.Add(new Label())); Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); }
private VisualElement CreateActionIndicator(UpgradeAction action) { UpgradeAction.UpgradeDetails nextUpgrade; try { nextUpgrade = action.upgradeDetails.First(u => !playerData.TechnologyData.HasTechnology(u.tech)); } catch { var label = new Label(action.name.Replace("Upgrade", "")); label.AddToClassList("action-button"); label.AddToClassList("action-button-researched"); var costDisplay = new Label("(purchased)"); costDisplay.AddToClassList("action-cost"); label.Add(costDisplay); return(label); } return(CreateButton( nextUpgrade.title.Replace("Upgrade", ""), nextUpgrade.cost, () => ProcessUpgradeAction(nextUpgrade), newCost => UpdateActionCost(action, nextUpgrade, newCost), false )); }
public MnistDataSet(String fileNameOfDataFile, String fileNameOfLabelFile) { Byte[] dataBuf = System.IO.File.ReadAllBytes(fileNameOfDataFile); Byte[] fileBuf = System.IO.File.ReadAllBytes(fileNameOfLabelFile); for (int i = 0; i < dataBuf.Length; i++) { if (i < 16) { continue; } float val = dataBuf[i] / 256.0f; Data.Add(val); } fixed(Byte *pFileBuf = fileBuf) { Byte *pLabelData0 = pFileBuf + 8; int count = fileBuf.Length - 8; for (int i = 0; i < count; i++) { Label.Add(pLabelData0[i]); } Count = count; } }
public AnalysisIdentifier(KeyValuePair <Identifier, Interval> result, string formatString) { Name = result.Key.Name.ToString(); ID = result.Key.Id.ToString(); Label.Add(result.Value.ToString()); FormatString = formatString; }
public AnalysisIdentifier(RDDefinition result, string formatString) { Name = result.IdentityName.ToString(); Label.Add(result.Label.ToString()); ID = result.IdentityID.ToString(); FormatString = formatString; }
void CreateHierarchy() { AddToClassList("unity-enum-field"); m_DropDownButton = new Label(); m_DropDownButton.AddToClassList("unity-enum-field__input"); m_DropDownButton.AddManipulator(new DownClickable(OnClick)); m_ValueText = new TextElement(); m_ValueText.AddToClassList("unity-enum-field__text"); var icon = new VisualElement() { name = "icon" }; icon.AddToClassList("unity-enum-field__arrow"); m_DropDownButton.Add(m_ValueText); m_DropDownButton.Add(icon); }
public CursorTestStack(string name, string header) : base(name, header, "FPS") { var label = new Label("Text") { name = "child1" }; var label2 = new Label("Thumb up") { name = "child2" }; var label3 = new Label("Pan") { name = "child3" }; label.Add(label2); label2.Add(label3); m_Content.Add(label); }
public VFXEnumField(string label, System.Type enumType) : base(label) { CreateHierarchy(); if (!enumType.IsEnum) { Debug.LogError("The type passed To enumfield must be an enumType"); } m_EnumType = enumType; style.flexDirection = FlexDirection.Row; Add(m_DropDownButton); var icon = new VisualElement() { name = "icon" }; icon.AddToClassList("unity-enum-field__arrow"); m_DropDownButton.Add(icon); }
void UpdateEventCallbacks(EventDebuggerEventRecord eventBase) { ClearEventCallbacks(); if (eventBase == null) { return; } var callbacks = m_Debugger.GetCalls(panel, eventBase); if (callbacks != null) { foreach (EventDebuggerCallTrace callback in callbacks) { VisualElement container = new VisualElement { name = "line-container" }; Label timeStamp = new Label { name = "timestamp" }; Label handler = new Label { name = "handler" }; Label phaseDurationContainer = new Label { name = "phaseDurationContainer" }; Label phase = new Label { name = "phase" }; Label duration = new Label { name = "duration" }; timeStamp.AddToClassList("log-line-item"); handler.AddToClassList("log-line-item"); phaseDurationContainer.AddToClassList("log-line-item"); timeStamp.text = "[" + eventBase.TimestampString() + "]"; handler.text = callback.callbackName; if (callback.immediatePropagationHasStopped) { handler.text += " Immediately Stopped Propagation"; } else if (callback.propagationHasStopped) { handler.text += " Stopped Propagation"; } if (callback.defaultHasBeenPrevented) { handler.text += " (Default Prevented)"; } phase.text = callback.eventBase.propagationPhase.ToString(); duration.text = "Duration: " + callback.duration / 1000f + "ms"; container.Add(timeStamp); container.Add(handler); phaseDurationContainer.Add(phase); phaseDurationContainer.Add(duration); container.Add(phaseDurationContainer); m_EventCallbacksScrollView.Add(container); var hash = callback.callbackHashCode; HighlightCodeline(hash); } } var defaultActions = m_Debugger.GetDefaultActions(panel, eventBase); if (defaultActions == null) { return; } foreach (EventDebuggerDefaultActionTrace defaultAction in defaultActions) { VisualElement container = new VisualElement { name = "line-container" }; Label timeStamp = new Label { name = "timestamp" }; Label handler = new Label { name = "handler" }; Label phaseDurationContainer = new Label { name = "phaseDurationContainer" }; Label phase = new Label { name = "phase" }; Label duration = new Label { name = "duration" }; timeStamp.AddToClassList("log-line-item"); handler.AddToClassList("log-line-item"); phaseDurationContainer.AddToClassList("log-line-item"); timeStamp.text = "[" + eventBase.TimestampString() + "]"; handler.text = defaultAction.targetName + "." + (defaultAction.phase == PropagationPhase.AtTarget ? "ExecuteDefaultActionAtTarget" : "ExecuteDefaultAction"); duration.text = "Duration: " + defaultAction.duration / 1000f + "ms"; container.Add(timeStamp); container.Add(handler); phaseDurationContainer.Add(phase); phaseDurationContainer.Add(duration); container.Add(phaseDurationContainer); m_EventCallbacksScrollView.Add(container); } }