示例#1
0
 //构造函数
 public LoginVM()
 {
     IsEnable = true;
     UserInfo = new UserInfo();
     BtnLoginCmd = new RelayCommand(new Action<object>(Login));
     BtnSignCmd = new RelayCommand(new Action<object>(Sign));
 }
示例#2
0
 public LobbyVM()
 {
     del = new Del(DealReceivePre);
     RoomNum = 0;
     SeatNum = 0;
     CanJoin = false;
     CanCreat = true;
     CanStart = false;
     IsEnable = true;
     RoomList = new ObservableCollection<LobbyRoom>();
     PlayerList = new ObservableCollection<LobbyPlayer>();
     ThReceive = new Thread(ReceiveSocket);
     ThReceive.IsBackground = true;
     ThReceive.Start(App.NetCtrl.SocketClient);
     App.NetCtrl.Send("2|3|1|");
     BtnJoinCmd = new RelayCommand(new Action(Join));
     BtnCreatCmd = new RelayCommand(new Action(Creat));
     BtnStartCmd = new RelayCommand(new Action(Start));
 }
示例#3
0
        //构造函数
        public GameVM(int num, int rNum, int sNum)
        {
            SNum = sNum;
            RNum = rNum;
            SelectMultiCmd = new RelayCommand(new Action<object>(SelectMulti));
            CancelSelectCmd = new RelayCommand(new Action(CancelSelect));
            ShowHandCardsCmd = new RelayCommand(new Action(ShowHandCards));
            SelectCmd = new RelayCommand(new Action(Select));
            BuildCmd = new RelayCommand(new Action(Build));
            KillCmd = new RelayCommand(new Action(Kill));
            StoleCmd = new RelayCommand(new Action(Stole));
            SwapWithPlayerCmd = new RelayCommand(new Action(SwapWithPlayer));
            SwapWithCardsCmd = new RelayCommand(new Action(SwapWithCards));
            DestroyCmd = new RelayCommand(new Action(Destroy));
            BlacksmithCmd = new RelayCommand(new Action(Blacksmith));
            LaboratoryCmd = new RelayCommand(new Action(Laboratory));
            ChatCmd = new RelayCommand(new Action(Chat));
            SelectMoneyCmd = new RelayCommand(new Action(SelectMoney));
            SelectBuildingCmd = new RelayCommand(new Action(SelectBuilding));
            RoundOverCmd = new RelayCommand(new Action(RoundOver));
            UseCemeteryCmd = new RelayCommand(new Action(UseCemetery));
            GiveUpCemeteryCmd = new RelayCommand(new Action(GiveUpCemetery));
            OverEnterCmd = new RelayCommand(new Action(OverEnter));
            del = new Del(DealReceivePre);
            ThReceive = new Thread(ReceiveSocket);
            ThReceive.IsBackground = true;
            ThReceive.Start(App.NetCtrl.SocketClient);
            CardRes = new CardRes();
            CenterBuildings = new ObservableCollection<Building>();
            CenterHeros = new ObservableCollection<Hero>();
            CenterPlayer = new ObservableCollection<GamePlayer>();
            PocketBuildings = new ObservableCollection<Building>();
            GamePlayerList = new ObservableCollection<GamePlayer>();
            OverGamePlayers = new ObservableCollection<GamePlayer>();
            for (int i = 0; i < num; i++)
            {
                if (i == (SNum - 1))
                    GamePlayerList.Add(new GamePlayer(SNum, App.UserInfo.Nick, App.UserInfo.Exp, 0));
                else
                    GamePlayerList.Add(new GamePlayer(i + 1, "", 0, 0));
            }
            IsCenterBuildingMultiVisable = false;
            IsCenterBuildingVisable = false;
            IsCenterHeroVisable = false;
            IsCenterPlayerVisable = false;
            IsCenterBuildingPocketVisable = false;
            IsCenterRoundStartVisible = false;
            IsCenterCemeteryVisible = false;
            IsRoundOver = true;
            IsRoundOverEnable = true;
            IsWall = false;
            IsGameOverVisible = false;
            IsWin = false;
            IsEnable = true;
            ChatText = "";
            ChatLog = "";
            BattleLog = "\n\n\n\n\n\n\n\n这里是战报实时显示:\n";
            Index = -1;
            Step = -1;
            DestroyedSNum = -1;
            IsStepFinished = new ObservableCollection<bool>(new List<bool> { true,true,true,true,true, true,
                true, true, true, true, true, true, true, true,true,true,true });

            Send("3|1|1|" + RNum + "|" + SNum + "|");

            #region 测试
            Test1Text = "发送测试信息";
            Test2Text = "测试2";
            Test3Text = "测试3";
            Test1Cmd = new RelayCommand(new Action(Test1));
            Test2Cmd = new RelayCommand(new Action(Test2));
            Test3Cmd = new RelayCommand(new Action(Test3));

            //PocketBuildings.Add(CardRes.Buildings[12]);
            //PocketBuildings.Add(CardRes.Buildings[14]);
            //PocketBuildings.Add(CardRes.Buildings[17]);
            //PocketBuildings.Add(CardRes.Buildings[19]);

            //CenterBuildings.Clear();

            //foreach (var item in PocketBuildings)
            //{
            //    CenterBuildings.Add(item);
            //}

            //IsCenterBuildingMultiVisable = true;

            //#region 默认卡牌
            //GamePlayerList[0].Nick = "默认1";
            //GamePlayerList[1].Nick = "默认2";
            //GamePlayerList[2].Nick = "默认3";
            //GamePlayerList[0].Buildings.Add(CardRes.Buildings[12]);
            //GamePlayerList[0].Buildings.Add(CardRes.Buildings[14]);
            //GamePlayerList[1].Buildings.Add(CardRes.Buildings[17]);
            //GamePlayerList[1].Buildings.Add(CardRes.Buildings[19]);
            //GamePlayerList[2].Buildings.Add(CardRes.Buildings[24]);
            //GamePlayerList[2].Buildings.Add(CardRes.Buildings[29]);
            //PocketBuildings.Add(CardRes.Buildings[34]);
            //PocketBuildings.Add(CardRes.Buildings[39]);
            //#endregion

            #endregion
        }