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


C# Switch.getOnOff方法代碼示例

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


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

示例1: LoadContent


//.........這裏部分代碼省略.........
            freeze.isSeeable = false;

            #region PlayAgainMenu
            // title for play again menu
            Text playAgain = new Text("Play Again?", font)
            {
                attributes = new Attributes()
                {
                    color = Color.Black,
                    depth = 0f,
                },
                height = 200
            };

            // button names for play again menu
            String[] PAButtonNames = new String[2];
            PAButtonNames[0] = "Yes";
            PAButtonNames[1] = "No";

            // starts new game or goes to main menu depending on choice
            Button.ClickHandler[] playAgainAction = new Button.ClickHandler[2];
            // if playagain is chosen from the menu, following options are available
            playAgainAction[0] = delegate() {
                player1.Reset(); player2.Reset(); computer.Reset();
                if (speed != null)
                {
                    // switch based on what speed game type is being played
                    switch (speed.myType)
                    {
                        //
                            // game length?
                        case Speed.gameType.Timed:
                            int x = speed.gameLength;
                            speed = new Speed(cards, background, selector, font, speed.you, speed.opp, textures, speed.myType, shuffle, playcard, shuffleinstance, SoundSwitch.getOnOff(), PowerUpSwitch.getOnOff(), vibrateOn, freeze);
                            speed.gameLength = x;
                            break;
                        //
                        case Speed.gameType.Marathon:
                            int y = speed.winningscore;
                            speed = new Speed(cards, background, selector, font, speed.you, speed.opp, textures, speed.myType, shuffle, playcard, shuffleinstance, SoundSwitch.getOnOff(), PowerUpSwitch.getOnOff(), vibrateOn, freeze);
                            speed.winningscore = y;
                            break;
                        // if neither of the other cases apply, do this default action
                        default:
                            speed = new Speed(cards, background, selector, font, speed.you, speed.opp, textures, speed.myType, shuffle, playcard, shuffleinstance, SoundSwitch.getOnOff(), PowerUpSwitch.getOnOff(), vibrateOn, freeze);
                            break;
                    }
                    speed.TurnOn(); PlayAgain.isPaused = true;
                }

                if (levels != null) {
                    levels = new Levels(cards, background, selector, font, levels._player1, textures, shuffle, playcard, shuffleinstance, SoundSwitch.getOnOff(), PowerUpSwitch.getOnOff(), vibrateOn, (Levels.Difficulty) DifficultySwitch.getState(), freeze);
                    levels.StartGame();
                    PlayAgain.isPaused = true;
                }
            };
            // if exit is chosen, nullifies levels or speed, returns to main menu
            playAgainAction[1] = delegate()
            {
                if (speed != null) speed = null;
                if (levels != null) levels = null;
                PlayAgain.isPaused = true; MainMenu.isPaused = false;
            };

            // makes playagain menu
            PlayAgain = new Menu(playAgainBackground, 2, playAgain, PAButtonNames, playAgainAction, font, 100, true);
開發者ID:rabdureh,項目名稱:SPEGame,代碼行數:67,代碼來源:Game1.cs


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