Exemplo n.º 1
0
        private void ShowNames()
        {
            Sound.Pray();
            MagicCircle.Show(this, 3000, () =>
            {
                Flash.Show(this, 1000, () =>
                {
                    Second.IsVisible = true;
                    var masters      = CodeMasterServce.GetMasters <JobMaster>();
                    var target1      = CodeMasterServce.GetNameRandom();
                    while (_vm.User.Names.Any(item => target1.Attribute == item.Attribute))
                    {
                        target1 = CodeMasterServce.GetNameRandom();
                    }
                    var target2 = masters[MyRandom.GetRandom(masters.Count)];
                    var gotName = new Name(target1, target2);
                    _vm.User.Names.Add(gotName);

                    var name               = new Chu2Name();
                    name.BindingContext    = gotName;
                    name.ShowAttribute     = true;
                    name.ShowAttributeType = true;
                    name.ShowParameter     = true;
                    GetResult.Children.Add(name);

                    var image               = new Charactor();
                    image.BindingContext    = gotName;
                    image.HorizontalOptions = LayoutOptions.End;
                    Second.Children.Insert(0, image);

                    Device.StartTimer(TimeSpan.FromSeconds(3), () =>
                    {
                        if (_vm.User.Names.Count == 2)
                        {
                            Second.IsVisible  = false;
                            Third.IsVisible   = true;
                            _vm.User.MainName = _vm.User.Names[0];
                            _vm.User.SubName  = _vm.User.Names[1];
                            Sound.Normal();
                            _steps.Next();
                        }
                        else
                        {
                            GetResult.Children.Clear();
                            Second.Children.Remove(image);
                            ShowNames();
                        }
                        return(false);
                    });
                });
            });
        }
Exemplo n.º 2
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            var vm = BindingContext as MainViewModel;

            if (vm == null)
            {
                return;
            }

            var num     = 0;
            var masters = CodeMasterServce.GetMasters <AttributeMaster>();

            foreach (var master in masters)
            {
                var attribute = new Attribute();

                var hasAttribute = vm.User.Names.Any((name) => name.Attribute == master.Code);
                attribute.BindingContext = new
                {
                    CharactorColor = hasAttribute ? Color.FromHex(CodeMasterServce.GetValue <ColorMaster>(master.Code)) : Color.Transparent,
                    AttributeName  = master.Value
                };
                if (!hasAttribute)
                {
                    attribute.Opacity = 0.5;
                }
                if (num < masters.Count / 2)
                {
                    AttributeDisplay.Children.Add(attribute);
                }
                else
                {
                    AttributeDisplay2.Children.Add(attribute);
                }
                num++;
            }
        }
Exemplo n.º 3
0
 private static void SetOtherUserProfile(IList <UserProfile> others)
 {
     for (var j = 0; j < 10; j++)
     {
         var p = new UserProfile();
         for (var i = 0; i < 5; i++)
         {
             p.Names.Add(new Name()
             {
                 First  = (MyRandom.GetRandom(CodeMasterServce.GetMasters <NameMaster>().Count() - 1) + 1).ToString(),
                 Second = (MyRandom.GetRandom(CodeMasterServce.GetMasters <JobMaster>().Count() - 1) + 1).ToString()
             });
         }
         p.MainName    = p.Names[0];
         p.SubName     = p.Names[1];
         p.WinComment  = "ククク、たわいもない";
         p.LoseComment = "今日のところは勘弁してやろう";
         p.BattleComment.Add("まだまだ");
         p.BattleComment.Add("ここからが本番だぞ");
         p.BattleComment.Add("なかなかやるようだな");
         p.PlayerName = "上田" + j;
         others.Add(p);
     }
 }
Exemplo n.º 4
0
        private void ShowSecond()
        {
            First.IsVisible = false;
            if (!string.IsNullOrEmpty(_achivementCode))
            {
                StartPrayText.Text = "実績解禁!!";
            }
            StartPray.IsVisible = true;
            Sound.Pray();
            Sound.PrayVoice();
            MagicCircle.Show(this, 3000, () =>
            {
                StartPray.IsVisible = false;
                Flash.Show(this, 1000, () =>
                {
                    Second.IsVisible = true;
                    var masters      = CodeMasterServce.GetMasters <JobMaster>();
                    var target1      = string.IsNullOrEmpty(_achivementCode) ? CodeMasterServce.GetNameRandom() : CodeMasterServce.GetNameRandomByAttribute(_achivementCode);
                    var target2      = masters[MyRandom.GetRandom(masters.Count)];
                    var gotName      = new Name(target1, target2);

                    var name               = new Chu2Name();
                    name.BindingContext    = gotName;
                    name.ShowAttribute     = true;
                    name.ShowAttributeType = true;
                    name.ShowParameter     = true;
                    GetResult.Children.Add(name);

                    var image               = new Charactor();
                    image.BindingContext    = gotName;
                    image.HorizontalOptions = LayoutOptions.End;
                    Second.Children.Insert(0, image);

                    _current.CountUpPray();

                    var hasName = _current.Names.FirstOrDefault(n => n.Attribute == gotName.Attribute);

                    if (hasName != null)
                    {
                        BackButton.IsVisible = false;
                        Device.StartTimer(TimeSpan.FromSeconds(3), () =>
                        {
                            SelectItem.Show(this, "同じ属性の二つ名を既に持っています。二つ名を入れ替えますか?",
                                            new List <SelectItem.Item>()
                            {
                                new SelectItem.Item()
                                {
                                    Label    = "二つ名を入れ替える",
                                    Selected = () => {
                                        _current.Names.Remove(hasName);
                                        AddNewName(gotName);
                                        Device.StartTimer(TimeSpan.FromSeconds(2), () => { Back(); return(false); });
                                    }
                                },
                                new SelectItem.Item()
                                {
                                    Label    = "キャンセル",
                                    Selected = () => {
                                        CutIn.Show(this, "二つ名の取得をキャンセルしました", 3, () => { Back(); });
                                    }
                                }
                            });
                            return(false);
                        });
                    }
                    else
                    {
                        AddNewName(gotName);
                    }
                });
            });
        }