示例#1
0
 public TitleChildSceneAccountSelect(AccountInformation ai, bool back)
 {
     ainfo = ai;
     backing = back;
 }
示例#2
0
        public IEnumerator<bool> Execute()
        {
            DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);
            info = new AccountInformation(Kbtter.Instance.Setting.Accounts.ToArray());
            //The Kbtter Project
            var kbp = new Sprite() { Image = CommonObjects.ImageKbtterProject, HomeX = 256, HomeY = 32, X = 320, Y = 240 };
            Manager.Add(kbp, 0);
            for (int i = 0; i < 120; i++)
            {
                kbp.ScaleX = kbp.ScaleY = Easing.OutBounce(i, 120, 4, -3);
                kbp.Alpha = Easing.OutSine(i, 120, 0, 1);
                yield return true;
            }
            kbp.ScaleX = kbp.ScaleY = 1;
            kbp.Alpha = 1;
            for (int i = 0; i < 120; i++) yield return true;
            for (int i = 0; i < 60; i++)
            {
                kbp.Alpha = Easing.OutSine(i, 60, 1, -1);
                yield return true;
            }
            kbp.IsDead = true;

            //タイトル画面
            var back = new RectangleObject() { Width = 640, Height = 480, Color = CommonObjects.Colors.White, AllowFill = true };
            Manager.Add(back, 0);
            for (int i = 0; i < 60; i++)
            {
                back.Alpha = Easing.OutSine(i, 60, 0, 1);
                yield return true;
            }
            back.Alpha = 1;

            var logo = new Sprite() { Image = CommonObjects.ImageLogo, HomeX = 240, HomeY = 80, X = 320 };
            Manager.Add(logo, 1);
            for (int i = 0; i < 60; i++)
            {
                logo.Y = Easing.OutBounce(i, 60, -160, 320);
                yield return true;
            }

            //Press Z
            var pz = new StringSprite(CommonObjects.FontSystemBig, CommonObjects.Colors.Black) { Value = "Press Button", X = 320, Y = 400, HomeX = 160 };
            var pzdx = DX.GetDrawStringWidthToHandle("Press Button", 12, CommonObjects.FontSystemBig);
            pz.HomeX = pzdx / 2;
            Manager.Add(pz, 1);
            do
            {
                for (int i = 0; i < 30 && !tstate.Buttons.Any(p => p); i++)
                {
                    pz.Alpha = Easing.Linear(i, 30, 0, 1);
                    yield return true;
                }
                for (int i = 0; i < 30 && !tstate.Buttons.Any(p => p); i++)
                {
                    pz.Alpha = Easing.Linear(i, 30, 1, -1);
                    yield return true;
                }
            } while (!tstate.Buttons.Any(p => p));
            CommonObjects.SoundMenuOK.Play();
            var st = pz.Alpha;
            for (int i = 0; i < 30; i++)
            {
                pz.Alpha = Easing.Linear(i, 30, st, -st);
                yield return true;
            }
            pz.IsDead = true;

            //menu
            menu = new[]
            {
                new AdditionalCoroutineSprite(){HomeX=160,HomeY=64,Image=CommonObjects.ImageTitleMenuStart,Y=720},
                new AdditionalCoroutineSprite(){HomeX=160,HomeY=64,Image=CommonObjects.ImageTitleMenuQuick,Y=720},
                new AdditionalCoroutineSprite(){HomeX=160,HomeY=64,Image=CommonObjects.ImageTitleMenuOption,Y=720},
                new AdditionalCoroutineSprite(){HomeX=160,HomeY=64,Image=CommonObjects.ImageTitleMenuRanking,Y=720},
            };
            Manager.AddRangeTo(menu, 1);
            for (int i = 0; i < menu.Length; i++)
            {
                menu[i].X = 320 + 256 * i;
                if (i != selmenu)
                {
                    menu[i].Alpha = 0.5;
                    menu[i].ScaleX = menu[i].ScaleY = 0.8;
                }
                menu[i].ApplySpecialOperation(SpritePatterns.MenuIntro(i * 15, 60, 400));
            }

            lrc = new[]
            {
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.5,ScaleY=0.8,Image=CommonObjects.ImageCursor128[0],X=120,Y=400},
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.5,ScaleY=0.8,Image=CommonObjects.ImageCursor128[1],X=520,Y=400},
            };
            Manager.AddRangeTo(lrc, 2);
            foreach (var i in lrc) i.AddSubOperation(SpritePatterns.Blink(30, 0.8, Easing.Linear));

            while (true)
            {
                switch (modestate)
                {
                    case 0:
                        //メニュー選択
                        while (!menu.All(p => p.SpecialOperation == null)) yield return true;
                        while (true)
                        {
                            if ((tstate.Direction & GamepadDirection.Left) != 0)
                            {
                                selmenu = (selmenu + menu.Length - 1) % menu.Length;
                                RefreshMenuPosition();
                                CommonObjects.SoundMenuSelect.Play();
                            }
                            if ((tstate.Direction & GamepadDirection.Right) != 0)
                            {
                                selmenu = (selmenu + 1) % menu.Length;
                                RefreshMenuPosition();
                                CommonObjects.SoundMenuSelect.Play();
                            }
                            if (tstate.Buttons[0])
                            {
                                //救済措置
                                if (selmenu == 0)
                                {
                                    CommonObjects.SoundMenuOK.Play();
                                    for (int i = 0; i < menu.Length; i++)
                                    {
                                        menu[i].ApplySpecialOperation(SpritePatterns.MenuIntro(0, 60, 600));
                                    }
                                    foreach (var i in lrc) i.AddSubOperation(SpritePatterns.MenuOutro(0, 60, 600));
                                    break;
                                }
                            }
                            yield return true;
                        }
                        switch (selmenu)
                        {
                            case 0:
                                //Start
                                Children.AddChildScene(new TitleChildSceneAccountSelect(info));
                                break;
                            case 1:
                                //Quick
                                break;
                            case 2:
                                //Option
                                break;
                            case 3:
                                //Ranking
                                break;
                        }
                        modestate = 1;
                        break;
                    case 1:
                        //サブタスク動作
                        yield return true;
                        break;
                    case 2:
                        for (int i = 0; i < 60; i++)
                        {
                            Manager.Alpha -= 1.0 / 60.0;
                            yield return true;
                        }
                        Manager.Alpha = 0;
                        goto EXIT;
                }
            }
            EXIT:
            Kbtter5.CurrentScene = new SceneGame(info.Accounts[selac], new UserInformation(info.Users[selac]), optinfo);
        }
示例#3
0
 public TitleChildSceneAccountSelect(AccountInformation ai)
 {
     ainfo = ai;
 }
示例#4
0
        public TitleChildSceneOptionUserSelect(AccountInformation ainfo, int idx, bool back, User[] us)
        {
            b = back;
            ai = ainfo;
            uinfo = new UserInformation(ai.Users[idx]);
            index = idx;
            mvf = (ta, aid, max) => (mai, val) =>
            {
                if (max > aid) ta[aid].Alpha = val ? 1.0 : 0.5;
            };
            users = us;
            opod = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 64 - 8, Value = "1st" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 96 - 8, Value = "2nd" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 128 - 8, Value = "3rd" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 160 - 8, Value = "4th" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 192 - 8, Value = "5th" }
            };
            next = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Blue) { X = 64, Y = nextpos - 8, Value = "決定" };
            opsn = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 64 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 96 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 128 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 160 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 192 - 8, Value = "" }
            };
            mal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){ X = 32, Y = 64 },
                new MenuAllocationInformation(){ X = 32, Y = 96 },
                new MenuAllocationInformation(){ X = 32, Y = 128 },
                new MenuAllocationInformation(){ X = 32, Y = 160 },
                new MenuAllocationInformation(){ X = 32, Y = 192 },
                new MenuAllocationInformation(){ X = 32, Y = 224 },
            };
            opop = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 224 - 8, Value = "編集        削除" };
            opopmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){X=40,Y=224},
                new MenuAllocationInformation(){X=136,Y=224},
            };

            okcancel = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "OK", X = 528, Y = 180 , Alpha = 0},
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "キャンセル", X = 528, Y = 204, Alpha = 0 }
            };
            ocmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){X=512,Y=180+8,IsAvailable=false},
                new MenuAllocationInformation(){X=512,Y=204+8},
            };
            ouip = new OptionUserInformationPanel(ai.Tokens[index], ai.Users[index])
            {
                ChangingAction = (p) =>
                {
                    //タイムラグ対策
                    if (cs != 2) return;
                    if (p && users.Where(q => q != null).All(q => q.Id != ouip.SourceUser.Id))
                    {
                        valid.Value = "オプションOK";
                        valid.Color = CommonObjects.Colors.Blue;
                        ocmal[0].IsAvailable = true;
                    }
                    else
                    {
                        valid.Value = "オプションNG";
                        valid.Color = CommonObjects.Colors.Red;
                        ocmsel = 1;
                        ocmal[0].IsAvailable = false;
                        mc.AddSubOperation(SpritePatterns.VerticalMove(10, ocmal[ocmsel].Y, Easing.OutQuad));
                    }
                }
            };
            for (int i = 0; i < opopmal.Count; i++)
            {
                opopmal[i].Lefter = opopmal[(i + opopmal.Count - 1) % opopmal.Count];
                opopmal[i].Righter = opopmal[(i + 1) % opopmal.Count];
            }
            for (int i = 0; i < ocmal.Count; i++)
            {
                ocmal[i].Upper = ocmal[(i + ocmal.Count - 1) % ocmal.Count];
                ocmal[i].Lower = ocmal[(i + 1) % ocmal.Count];
                ocmal[i].AvailableChangingAction = mvf(okcancel, i, okcancel.Count);
            }
            for (int i = 0; i < mal.Count; i++)
            {
                mal[i].Upper = mal[(i + mal.Count - 1) % mal.Count];
                mal[i].Lower = mal[(i + 1) % mal.Count];
                mal[i].AvailableChangingAction = mvf(opod, i, opod.Count);
                mal[i].IsAvailable = (i < users.Length && users[i] != null) || i == mal.Count - 1 || (users.Count(p => p != null) == i);
            }
            for (int i = 0; i < opsn.Count; i++)
            {
                if (users[i] != null) opsn[i].Value = users[i].ScreenName;
            }

            valid = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 320, Y = 216, Value = "オプションOK/NG" };
            mc = new MultiAdditionalCoroutineSprite() { Image = CommonObjects.ImageCursor128[1], HomeX = 64, HomeY = 64, ScaleX = 0.25, ScaleY = 0.25 };
            cs = 0;
            ki = null;
            msel = 0;
            ocmsel = 0;
        }