Пример #1
0
        public override IEnumerator<bool> Execute()
        {
            Manager.Add(sum, 1);
            Manager.AddRangeTo(uvs, 1);
            Manager.AddRangeTo(seluvs, 1);
            Manager.AddRangeTo(udc, 2);
            foreach (var i in udc) i.AddSubOperation(SpritePatterns.Blink(30, 0.8, Easing.Linear));
            Manager.Add(mc, 2);
            Manager.AddRangeTo(selopts, 1);
            Manager.OffsetX = 640;
            Manager.OffsetY = 240;
            //突入
            for (int i = 0; i < 40; i++)
            {
                Manager.OffsetX = Easing.OutQuad(i, 40, 640, -640);
                yield return true;
            }
            Manager.OffsetX = 0;

            prevstate = Gamepad.GetState();
            while (true)
            {
                state = Gamepad.GetState();
                tstate = state.GetTriggerStateWith(prevstate);
                switch (cstate)
                {
                    case 0:
                        if (tstate.Buttons[1])
                        {
                            Parent.SendChildMessage("ReturnToOptionEdit");
                            CommonObjects.SoundMenuCancel.Play();
                            for (int i = 0; i < 40; i++)
                            {
                                Manager.OffsetX = Easing.OutQuad(i, 40, 0, 640);
                                yield return true;
                            }
                            goto EXIT;
                        }
                        if (tstate.Buttons[0])
                        {
                            CommonObjects.SoundMenuOK.Play();
                            if (usel == selopts.Count - 1)
                            {
                                var ol = new OptionInformation[5];
                                for (int i = 0; i < avu; i++)
                                {
                                    ol[i] = new OptionInformation(opts[i]);
                                    ol[i].TargetOperation = OptionOperations.SelectionInformation[osi[i]].Operation;
                                    ol[i].InitializationInformation = oii[i];
                                }
                                Parent.SendChildMessage("ApplyOptionInformation", ol);
                                Parent.SendChildMessage("StartGame");
                                for (int i = 0; i < 40; i++)
                                {
                                    Manager.OffsetX = Easing.OutQuad(i, 40, 0, -640);
                                    yield return true;
                                }
                                goto EXIT;
                            }
                            else
                            {
                                GoToEditingMode();
                            }
                        }
                        if ((tstate.Direction & GamepadDirection.Up) != 0)
                        {
                            selopts[usel].AddSubOperation(SpritePatterns.Alpha(15, 0, Easing.Linear));
                            selopts[usel].AddSubOperation(SpritePatterns.Move(15, selopts[usel].X, selopts[usel].Y - 96, Easing.OutQuad));
                            usel = (usel + (selopts.Count - 1)) % selopts.Count;
                            selopts[usel].Y = 128 + 96;
                            selopts[usel].AddSubOperation(SpritePatterns.Alpha(15, 1, Easing.Linear));
                            selopts[usel].AddSubOperation(SpritePatterns.Move(15, selopts[usel].X, selopts[usel].Y - 96, Easing.OutQuad));
                            if (usel < avu) RefreshOptionInformation(false);
                            smsel = 0;
                            mc.AddSubOperation(SpritePatterns.VerticalMove(10, uvsmal[smsel].Y, Easing.OutQuad));
                            CommonObjects.SoundMenuSelect.Play();
                        }
                        if ((tstate.Direction & GamepadDirection.Down) != 0)
                        {
                            selopts[usel].AddSubOperation(SpritePatterns.Alpha(15, 0, Easing.Linear));
                            selopts[usel].AddSubOperation(SpritePatterns.Move(15, selopts[usel].X, selopts[usel].Y + 96, Easing.OutQuad));
                            usel = (usel + 1) % selopts.Count;
                            selopts[usel].Y = 128 - 96;
                            selopts[usel].AddSubOperation(SpritePatterns.Alpha(15, 1, Easing.Linear));
                            selopts[usel].AddSubOperation(SpritePatterns.Move(15, selopts[usel].X, selopts[usel].Y + 96, Easing.OutQuad));
                            if (usel < avu) RefreshOptionInformation(false);
                            smsel = 0;
                            mc.AddSubOperation(SpritePatterns.VerticalMove(10, uvsmal[smsel].Y, Easing.OutQuad));
                            CommonObjects.SoundMenuSelect.Play();
                        }
                        break;
                    case 1:
                        SubMenuOperation();
                        break;
                    case 2:
                        if (!UserValueInputOperation())
                        {
                            var ivs = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "入力値が不正です!", X = seluvs[smsel].X, Y = seluvs[smsel].Y };
                            ivs.AddSubOperation(SpritePatterns.VerticalFadeOut(60, -64, Easing.OutQuad, Easing.Linear));
                            Manager.Add(ivs, 3);
                        }
                        break;
                }
                prevstate = state;
                yield return true;
            }
            EXIT: ;
        }
Пример #2
0
 public SceneGame(Kbtter4Account ac, UserInformation ui, OptionInformation[] opt)
 {
     optinfo = opt.Where(p => p != null).ToArray();
     info = ui;
     TwitterTokens = Tokens.Create(Kbtter.Setting.Consumer.Key, Kbtter.Setting.Consumer.Secret, ac.AccessToken, ac.AccessTokenSecret);
     Player = new PlayerUser(this, ui, PlayerMovingOperations.MouseOperaiton, PlayerShotOperations.Default, PlayerInputMethods.DefaultStyle);
     BackgroundImagePath = CommonObjects.GetUserFilePath("back_" + ui.SourceUser.Id.ToString() + ".png");
     Information = new InformationBox(info, Player)
     {
         X = 0,
         Y = 480
     };
     StringInfo = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.White)
     {
         X = 280,
         Y = 240,
         Value = "Loading"
     };
     options = new List<PlayerOption>();
     options.AddRange(optinfo.Select(p => new PlayerOption(Player, p, this)));
 }