当前位置: 首页>>代码示例>>C#>>正文


C# Button.OnClick方法代码示例

本文整理汇总了C#中Button.OnClick方法的典型用法代码示例。如果您正苦于以下问题:C# Button.OnClick方法的具体用法?C# Button.OnClick怎么用?C# Button.OnClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.OnClick方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

    protected override void Awake()
    {
        base.Awake();

        selectedSectorText = GameObject.Find("text_sector-name").GetComponent<Text>();
        sectorDescriptionText = GameObject.Find("text_sector-description").GetComponent<Text>();

        for (int i = 1; i < 5; i++)
        {
            int ic = i;
            sectorButtons[ic] = GameObject.Find("button_sector" + ic).GetComponent<Button>();
            sectorButtons[ic].OnClick(() => {
                selectedSector = ic;
                selectedSectorText.text = "Sector " + ic;
                sectorDescriptionText.text = Text.Get(string.Format("Sector{0}Description", ic));
            });
        }

        sendDroneButton = GameObject.Find("button_send-drone").GetComponent<Button>();
        sendDroneButton.OnClick(() => {
            if (selectedSector != 0 && MapController.EnterSector())
            {
                SwitchView(selectedSector == 1 ? ViewType.Sector1
                    : selectedSector == 2 ? ViewType.Sector2
                    : selectedSector == 3 ? ViewType.Sector3
                    : ViewType.Sector4);
            }
        });

        selectedSector = 1;
        selectedSectorText.text = "Sector 1";
        sectorDescriptionText.text = Text.Get("Sector1Description");
    }
开发者ID:Elringus,项目名称:BreachedUnity,代码行数:33,代码来源:MapView.cs

示例2: Main

    static void Main()
    {
        Button BtnStart = new Button();
        BtnStart.Draw();
        BtnStart.Click += GameStart;
        Console.WriteLine("S:게임 시작 , E:끝");
        for (; ; )
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo cki;
                cki = Console.ReadKey();
                if (cki.Key == ConsoleKey.S)
                {
                    BtnStart.OnClick();
                }
                if (cki.Key == ConsoleKey.E)
                {
                    break;
                }

            }
            System.Threading.Thread.Sleep(100);
        }
    }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:25,代码来源:Program.cs

示例3: Awake

    private void Awake()
    {
        mineralASlider = transform.Find("panel_sliders/slider_mineral-a").GetComponent<Slider>();
        mineralASlider.value = 1;
        mineralBSlider = transform.Find("panel_sliders/slider_mineral-b").GetComponent<Slider>();
        mineralBSlider.value = 1;
        mineralCSlider = transform.Find("panel_sliders/slider_mineral-c").GetComponent<Slider>();
        mineralCSlider.value = 1;

        synthFuelButton = transform.Find("button_synth-fuel").GetComponent<Button>();
        synthFuelButton.OnClick(() => { WorkshopController.SynthFuel(GetCurrentProbe()); AddProbe(GetCurrentProbe()); });

        mineralAFill = transform.Find("panel_triangle/image_triangle-fill-a").GetComponent<Image>();
        mineralAFill.fillAmount = 0;
        mineralBFill = transform.Find("panel_triangle/image_triangle-fill-b").GetComponent<Image>();
        mineralBFill.fillAmount = 0;
        mineralCFill = transform.Find("panel_triangle/image_triangle-fill-c").GetComponent<Image>();
        mineralCFill.fillAmount = 0;

        probesParent = transform.Find("panel_triangle/image_triangle-segments");

        for (int a = 1; a < 8; a++)
            for (int c = 1; c < 8; c++)
                if ((a + c) >= 2 && (a + c) <= 8)
                    AddProbe(new int[] {a, 0, c}, true);
    }
开发者ID:Elringus,项目名称:BreachedUnity,代码行数:26,代码来源:FuelPanel.cs

示例4: Awake

 private void Awake()
 {
     wiringText = transform.Find("text_wiring").GetComponent<Text>();
     alloyText = transform.Find("text_alloy").GetComponent<Text>();
     chipsText = transform.Find("text_chips").GetComponent<Text>();
     componentText = transform.Find("text_component").GetComponent<Text>();
     fixEngineButton = transform.Find("button_fix-engine").GetComponent<Button>();
     fixEngineButton.OnClick(() => WorkshopController.FixEngine());
 }
开发者ID:Elringus,项目名称:BreachedUnity,代码行数:9,代码来源:EnginePanel.cs

示例5: Awake

    private void Awake()
    {
        currentJournalDay = ServiceLocator.State.CurrentDay;

        journalText = transform.Find("text_journal").GetComponent<Text>();
        previousButton = transform.Find("button_previous").GetComponent<Button>();
        previousButton.OnClick(() => {
            currentJournalDay = Mathf.Clamp(currentJournalDay - 1, 1, ServiceLocator.State.CurrentDay);
            UpdateJournal();
        });
        nextButton = transform.Find("button_next").GetComponent<Button>();
        nextButton.OnClick(() =>
        {
            currentJournalDay = Mathf.Clamp(currentJournalDay + 1, 1, ServiceLocator.State.CurrentDay);
            UpdateJournal();
        });

        UpdateJournal();
    }
开发者ID:Elringus,项目名称:BreachedUnity,代码行数:19,代码来源:JournalPanel.cs

示例6: CreateButton

 private void CreateButton(Button btn)
 {
     if(btn.visible)
     {
         btn.selected = GUI.Button(getRectByIndex(btn.index, btn.width, btn.height), btn.text);
         if(btn.selected)
             btn.OnClick();
     }
 }
开发者ID:julfoi,项目名称:warfrare_irontouch,代码行数:9,代码来源:Menue.cs


注:本文中的Button.OnClick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。