當前位置: 首頁>>代碼示例>>C#>>正文


C# ActionBar.AddButton方法代碼示例

本文整理匯總了C#中ActionBar.AddButton方法的典型用法代碼示例。如果您正苦於以下問題:C# ActionBar.AddButton方法的具體用法?C# ActionBar.AddButton怎麽用?C# ActionBar.AddButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ActionBar的用法示例。


在下文中一共展示了ActionBar.AddButton方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SelectCrowdBar

 /// <summary>
 /// The default bar for selecting a new crowd.
 /// </summary>
 private ActionBar SelectCrowdBar()
 {
     ActionBar result = new ActionBar(true);
     result.AddToggle("Crowd Static", (bool b) => crowdStatic = b);
     result.AddButton("Cancel", Reset);
     return result;
 }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:10,代碼來源:CrowdAuthoringEditor.cs

示例2: InitDualGroupSelection

 /// <summary>
 /// Logic that handles selecting two groups of event stubs, and then executing a given action when
 /// both groups are selected and the Finish button is pressed.
 /// </summary>
 private void InitDualGroupSelection(Action<HashSet<EventStub>, HashSet<EventStub>> onSelectionEnd)
 {
     HashSet<EventStub> firstSet = new HashSet<EventStub>();
     HashSet<EventStub> secondSet = new HashSet<EventStub>();
     //all onClick actions
     Action<EventStub> highlightGreen = (EventStub evnt) => SetEventColor(evnt, Color.green);
     Action<EventStub> highlightMagenta = (EventStub evnt) => SetEventColor(evnt, Color.magenta);
     Action<EventStub> addToFirst = (EventStub e) => firstSet.Add(e);
     Action<EventStub> addToSecond = (EventStub e) => secondSet.Add(e);
     onEventLeftClick.Add(addToFirst);
     onEventLeftClick.Add(highlightGreen);
     ActionBar bar = new ActionBar(true);
     bar.AddButton("Cancel", () =>
     {
         onEventLeftClick.Remove(addToFirst);
         onEventLeftClick.Remove(addToSecond);
         onEventLeftClick.Remove(highlightGreen);
         onEventLeftClick.Remove(highlightMagenta);
         ResetEventColors(firstSet.Union(secondSet));
         parent.PopActionBar();
     });
     bar.AddButton("Next", () => 
         {
             onEventLeftClick.Remove(addToFirst);
             onEventLeftClick.Remove(highlightGreen);
             onEventLeftClick.Add(highlightMagenta);
             onEventLeftClick.Add(addToSecond);
             bar.RemoveButton("Next");
             bar.AddButton("Finish", () =>
             {
                 onEventLeftClick.Remove(addToSecond);
                 parent.PopActionBar();
                 onEventLeftClick.Remove(highlightMagenta);
                 ResetEventColors(firstSet.Union(secondSet));
                 onSelectionEnd.Invoke(firstSet, secondSet);
             });
         });
     parent.AddActionBar(bar);
 }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:43,代碼來源:MainWindow.cs

示例3: DefaultBar

    /// <summary>
    /// The default bar, shown when the GUI is first opened,and when event selection is finished.
    /// </summary>
    private ActionBar DefaultBar()
    {
        ActionBar result = new ActionBar(true);
        result.AddButton(new GUIContent("Select Crowd", "Select a crowd by spatial parameters"), StartCrowdSelection);
        result.AddButton(new GUIContent("Options", "Change options for FillIn and ordering of new Events"), 
            () => actionBars.Add(optionsBar));
        result.AddButton(new GUIContent("Clear", "Clear all Events and SmartObjects from the window"), 
            () => { mainWindow.Clear(); mainArea = mainWindow = mainWindow.Copy(); });
        result.AddButton(new GUIContent("Play", "Play the scene. Changes can not be made anymore once playback starts"),
            () => { highlighter.UnhighlightAll(); mainWindow.Play();  });
        result.AddButton("Load/Save", StartLoadSave);
        result.AddButton("Reset", () =>
        {
            StoryArcSerializer.Instance.Delete(StoryArcSerializer.TEMP_FILE_NAME, false);
            ImporterExporter.TrySaveToTemp();
            //clear all events there, otherwise it tries using destroyed smart objects 
            AuthoredEventManager.Instance.ClearAllEvents();
            //must clear all receivers from the behavior manager, else if a tree is running everything crashes
            BehaviorManager.Instance.ClearReceivers();
            //must deregister all current objects here, otherwise they stay in manager as null objects..
            foreach (SmartObject obj in new List<SmartObject>(ObjectManager.Instance.GetObjects()))
            {
                 ObjectManager.Instance.DeregisterSmartObject(obj);
            }
            Application.LoadLevel(Application.loadedLevel);
        });

        
        return result;
    }
開發者ID:fgeraci,項目名稱:CS195-Core,代碼行數:33,代碼來源:CrowdAuthoringEditor.cs


注:本文中的ActionBar.AddButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。