예제 #1
0
 /// <summary>
 /// 使用玩家物件技能1
 /// </summary>
 public virtual void UsePlayerSkill1()
 {
     if (Skill1 != null)
     {
         Skill1.Cast(this);
     }
 }
예제 #2
0
 private void deleteBtn_Click(object sender, EventArgs e)
 {
     if (searchBtnWasClicked == true || addBtnWasClicked == true)
     {
         var confirmResult = MessageBox.Show("Сигурни ли сте, че искате да изтриете записа?",
                                             "Потвърждение!!",
                                             MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             con.Open();
             SqlCommand cmd = con.CreateCommand();
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "DELETE from Skills where SkillID = '" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
             cmd.ExecuteNonQuery();
             con.Close();
             MessageBox.Show("Успешно изтрити данни!");
             Skill2.Visible = false;
             Skill1.Clear();
             Display();
         }
     }
     else
     {
         MessageBox.Show("Невалидна команда!");
         return;
     }
 }
예제 #3
0
 private void Start()
 {
     skill1 = GetComponent <Skill1>();
     skill2 = GetComponent <Skill2>();
     skill3 = GetComponent <Skill3>();
     skill4 = GetComponent <Skill4>();
 }
예제 #4
0
 /// <summary>
 /// 放開玩家物件技能1
 /// </summary>
 public virtual void ReleasePlayerSkill1()
 {
     if (Skill1 != null)
     {
         Skill1.Release(this);
     }
 }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     mp     = GetComponent <Slider> ();
     skill1 = GameObject.FindGameObjectWithTag("Skill1").GetComponent <Skill1> ();
     skill2 = GameObject.FindGameObjectWithTag("Skill2").GetComponent <Skill2> ();
     level  = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLevelData> ();
 }
예제 #6
0
    void ReadTest()
    {
        FileStream    fs   = new FileStream(Application.dataPath + "/123.xml", FileMode.Open);
        XmlSerializer bf   = new XmlSerializer(typeof(Skill1));
        Skill1        demo = bf.Deserialize(fs) as Skill1;

        //Debug.Log(demo.id);
        fs.Close();
        demo.Output();
    }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     slider = GetComponent <Slider>();
     hurt   = GetComponent <AudioSource>();
     anim   = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     level  = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLevelData> ();
     HP     = GameObject.FindGameObjectWithTag("HP").GetComponent <Slider>();
     exp    = GameObject.FindGameObjectWithTag("EXP").GetComponent <PlayerExperience> ();
     skill1 = GameObject.FindGameObjectWithTag("Skill1").GetComponent <Skill1> ();
     skill2 = GameObject.FindGameObjectWithTag("Skill2").GetComponent <Skill2> ();
     over   = GameObject.FindGameObjectWithTag("GameOver").GetComponent <GameOver> ();
     mis    = GameObject.FindGameObjectWithTag("Mission").GetComponent <MissionProgress> ();
 }
예제 #8
0
 // Use this for initialization
 void Start()
 {
     skill1 = GameObject.FindGameObjectWithTag("Skill1").GetComponent <Skill1> ();
     skill2 = GameObject.FindGameObjectWithTag("Skill2").GetComponent <Skill2> ();
     //skill3 = GameObject.FindGameObjectWithTag ("Skill3").GetComponent<Skill3> ();
     tool1       = GameObject.FindGameObjectWithTag("Tools1").GetComponent <Tool1>();
     tool2       = GameObject.FindGameObjectWithTag("Tools2").GetComponent <Tool2>();
     tool3       = GameObject.FindGameObjectWithTag("Tools3").GetComponent <Tool3>();
     respawn     = GameObject.FindGameObjectWithTag("Respawn").GetComponent <Transform> ();
     mp          = GameObject.FindGameObjectWithTag("MP").GetComponent <PlayerMPValue> ();
     hp          = GameObject.FindGameObjectWithTag("HP").GetComponent <PlayerHealth> ();
     transitions = GameObject.FindGameObjectWithTag("Transitions").GetComponent <Animator> ();
     audio       = GetComponent <AudioSource>();
     mis         = GameObject.FindGameObjectWithTag("Mission").GetComponent <MissionProgress> ();
 }
예제 #9
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            searchBtnWasClicked = true;
            con.Open();
            SqlCommand search = con.CreateCommand();

            search.CommandType = CommandType.Text;
            search.CommandText = "SELECT * from Skills where Name like '%" + Skill1.Text + "%' order by SkillID";
            search.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(search);

            da.Fill(dt);
            dataGridView1.DataSource = dt;
            dataGridView1.AutoResizeColumns();
            dataGridView1.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.Columns[0].HeaderText = "Номер";
            dataGridView1.Columns[1].HeaderText = "Наименование";
            con.Close();
            Skill1.Clear();
        }
예제 #10
0
        /// <summary>
        /// 開始遊戲
        /// </summary>
        /// <param name="potX">玩家起始點X</param>
        /// <param name="potY">玩家起始點Y</param>
        public void SetStart(int potX, int potY)
        {
            PlayerObject = CreatePlayerObject(potX, potY);
            if (Skill1 != null)
            {
                Skill1.Reset();
                PlayerObject.Skills.Add(Skill1);
            }

            if (Skill2 != null)
            {
                Skill2.Reset();
                PlayerObject.Skills.Add(Skill2);
            }

            GameObjects.Add(PlayerObject);
            (_UIEnergyBar.DrawObject as DrawUICounterBar).BindingCounter = PlayerObject.Energy;


            IsStart = true;
            DoAfterStart();
        }
예제 #11
0
 private void editBtn_Click(object sender, EventArgs e)
 {
     try
     {
         long   n = 1;
         double m = 1.0;
         if (long.TryParse(Skill2.Text, out n) && double.TryParse(Skill2.Text, out m))
         {
             MessageBox.Show("Не може да се добавят числови данни!");
             return;
         }
         if (Skill1.Text == "" && Skill2.Visible == true)
         {
             MessageBox.Show("Невалидни данни!");
             Skill2.Visible  = false;
             editBtn.Visible = false;
             return;
         }
         else
         {
             con.Open();
             SqlCommand search = con.CreateCommand();
             search.CommandType = CommandType.Text;
             search.CommandText = "UPDATE Skills set Name = '" + Skill2.Text + "' where Name = '" + Skill1.Text + "'";
             search.ExecuteNonQuery();
             con.Close();
             MessageBox.Show("Успешно обновяване!");
             Skill2.Visible  = false;
             editBtn.Visible = false;
             Skill1.Clear();
             Display();
         }
     }
     catch
     {
         MessageBox.Show("Не може едно умение да се повтаря повече от веднъж!");
     }
 }
예제 #12
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (Skill1.Text == "")
                {
                    MessageBox.Show("Невалидни данни!");
                    return;
                }

                long   n = 1;
                double m = 1.0;

                if (!long.TryParse(Skill1.Text, out n) && !double.TryParse(Skill1.Text, out m))
                {
                    con.Open();
                    SqlCommand cmd = con.CreateCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "INSERT into Skills values('" + Skill1.Text + "')";
                    cmd.ExecuteNonQuery();
                    con.Close();
                    MessageBox.Show("Успешно добавени данни!");
                    Skill2.Visible = false;
                    Skill1.Clear();
                    Display();
                    addBtnWasClicked = true;
                }
                else
                {
                    MessageBox.Show("Не може да се добавят числови данни!");
                }
            }
            catch
            {
                MessageBox.Show($"{Skill1.Text} вече съществува!");
            }
        }
예제 #13
0
    void Awake()
    {
        k_Manager = this;

        plantedFriends      = new List <List <int> > ();
        currentSkillList    = new List <GameObject> ();
        listedSkillManagers = new List <GameObject> ();

        playersOnline = new List <PlayerOnline> ();
        ItemImages    = Resources.LoadAll <Sprite>("RPG_inventory_icons");
        Backgrounds   = Resources.LoadAll <Sprite>("Backgrounds");

//		Stats = GameObject.FindGameObjectWithTag ("Stats");
//		PositionOverview = GameObject.FindGameObjectWithTag ("Positions");

//		Inventorys = GameObject.FindGameObjectWithTag ("InventorySlot");
//		CharacterSlot = GameObject.FindGameObjectWithTag ("CharacterSlots");
//		BackpackSlot = GameObject.FindGameObjectWithTag ("Backpack");
        k_player = GameObject.FindGameObjectWithTag("Player");
        k_player.GetComponent <Player> ().sceneloaded = true;
        pre_Item           = Resources.Load("Item") as GameObject;
        pre_FriendPosition = Resources.Load("FriendPositionImage") as GameObject;

        currentCharacter = k_player.GetComponent <Player> ().Characters [0];

        if (k_player.gameObject.GetComponent <Player>().OutstandingLoot.Count > 0)
        {
            LootPanel.SetActive(true);
            ApplyLoot();
        }

        Skills     = new GameObject[4];
        Skills [0] = Skill1;
        Skill1.GetComponent <SkillManager> ().id = 0;
        Skills [1] = Skill2;
        Skill2.GetComponent <SkillManager> ().id = 1;
        Skills [2] = Skill3;
        Skill3.GetComponent <SkillManager> ().id = 2;
        Skills [3] = Skill4;
        Skill4.GetComponent <SkillManager> ().id = 3;

        Positions = new GameObject[17];

        for (int i = 0; i < PositionOverview.transform.childCount; i++)
        {
            Positions [i] = PositionOverview.transform.GetChild(i).gameObject;
        }
        Positions [16] = GameObject.FindGameObjectWithTag("CharacterPositionSlot");

        InventorySlots = new GameObject[36];
        for (int i = 0; i < Inventorys.transform.childCount; i++)
        {
            InventorySlots [i] = Inventorys.transform.GetChild(i).gameObject;
        }

        CharacterSlots = new GameObject[10];
        for (int i = 1; i < CharacterSlot.transform.childCount - 1; i++)
        {
            CharacterSlots [i - 1] = CharacterSlot.transform.GetChild(i).gameObject;
        }

        BackpackSlots = new GameObject[8];
        for (int i = 0; i < BackpackSlot.transform.childCount; i++)
        {
            BackpackSlots [i] = BackpackSlot.transform.GetChild(i).gameObject;
        }

        pre_PlayerOnline = Resources.Load("PlayerOnline") as GameObject;
        PlayerPanel      = GameObject.FindGameObjectWithTag("PlayerOnline");

        SkillList = new GameObject[10];

        SkillList [0] = Skill_Start;
        SkillList [1] = Skill_First1;
        SkillList [2] = Skill_First2;
        SkillList [3] = Skill_Second1;
        SkillList [4] = Skill_Second2;
        SkillList [5] = Skill_Third1;
        SkillList [6] = Skill_Third2;
        SkillList [7] = Skill_Ultimate1;
        SkillList [8] = Skill_Ultimate2;
        SkillList [9] = Skill_Ultimate3;

        InstantiateItems();
        InstatiatePositionItems();

        this.SkillPoints = 20;

        SkillStats = new GameObject[4];

        for (int i = 0; i < SkillStats.Length; i++)
        {
            SkillStats [i] = SkillStat.transform.GetChild(i).gameObject;
        }
    }
예제 #14
0
 void Awake()
 {
     m_skill1 = GetComponentInChildren <Skill1>();
     m_skill2 = GetComponentInChildren <Skill2>();
 }
예제 #15
0
파일: Startup.cs 프로젝트: sxtgyrq/VRPGame
        private static async Task Echo(System.Net.WebSockets.WebSocket webSocket)
        {
            WebSocketReceiveResult wResult;

            {
                //byte[] buffer = new byte[size];
                //var buffer = new ArraySegment<byte>(new byte[8192]);
                State s = new State();
                s.WebsocketID        = ConnectInfo.webSocketID++;
                s.Ls                 = LoginState.empty;
                s.roomIndex          = -1;
                s.mapRoadAndCrossMd5 = "";
                removeWsIsNotOnline();
                addWs(webSocket, s.WebsocketID);

                var carsNames  = new string[] { "车1", "车2", "车3", "车4", "车5" };
                var playerName = "玩家" + Math.Abs(DateTime.Now.GetHashCode() % 10000);


                //if(s.Ls== LoginState.)

                do
                {
                    try
                    {
                        var returnResult = await ReceiveStringAsync(webSocket, webWsSize);

                        wResult = returnResult.wr;
                        Console.WriteLine($"receive from web:{returnResult.result}");
                        CommonClass.Command c = Newtonsoft.Json.JsonConvert.DeserializeObject <CommonClass.Command>(returnResult.result);
                        switch (c.c)
                        {
                        case "MapRoadAndCrossMd5":
                        {
                            if (s.Ls == LoginState.empty)
                            {
                                MapRoadAndCrossMd5 mapRoadAndCrossMd5 = Newtonsoft.Json.JsonConvert.DeserializeObject <MapRoadAndCrossMd5>(returnResult.result);
                                s.mapRoadAndCrossMd5 = mapRoadAndCrossMd5.mapRoadAndCrossMd5;
                            }
                        }; break;

                        case "CheckSession":
                        {
                            if (s.Ls == LoginState.empty)
                            {
                                CheckSession checkSession = Newtonsoft.Json.JsonConvert.DeserializeObject <CheckSession>(returnResult.result);
                                var          checkResult  = await BLL.CheckSessionBLL.checkIsOK(checkSession, s);

                                if (checkResult.CheckOK)
                                {
                                    s.Key       = checkResult.Key;
                                    s.roomIndex = checkResult.roomIndex;
                                    s           = await Room.setOnLine(s, webSocket);
                                }
                                else
                                {
                                    s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);
                                }
                            }
                        }; break;

                        case "JoinGameSingle":
                        {
                            JoinGameSingle joinType = Newtonsoft.Json.JsonConvert.DeserializeObject <JoinGameSingle>(returnResult.result);
                            if (s.Ls == LoginState.selectSingleTeamJoin)
                            {
                                s = await Room.GetRoomThenStart(s, webSocket, playerName, carsNames);
                            }
                        }; break;

                        case "CreateTeam":
                        {
                            CreateTeam ct = Newtonsoft.Json.JsonConvert.DeserializeObject <CreateTeam>(returnResult.result);
                            if (s.Ls == LoginState.selectSingleTeamJoin)
                            {
                                {
                                    string command_start;
                                    CommonClass.TeamResult team;
                                    {
                                        s = await Room.setState(s, webSocket, LoginState.WaitingToStart);
                                    }
                                    {
                                        //
                                        command_start = CommonClass.Random.GetMD5HashFromStr(s.WebsocketID.ToString() + s.WebsocketID);
                                        team          = await Team.createTeam2(s.WebsocketID, playerName, command_start);
                                    }
                                    {
                                        //var command_start = CommonClass.Random.GetMD5HashFromStr(s.WebsocketID.ToString() + s.WebsocketID);
                                        returnResult = await ReceiveStringAsync(webSocket, webWsSize);

                                        wResult = returnResult.wr;
                                        if (returnResult.result == command_start)
                                        {
                                            s = await Room.GetRoomThenStartAfterCreateTeam(s, webSocket, team, playerName, carsNames);
                                        }
                                        else
                                        {
                                            return;
                                        }
                                    }
                                }
                            }
                        }; break;

                        case "JoinTeam":
                        {
                            JoinTeam ct = Newtonsoft.Json.JsonConvert.DeserializeObject <JoinTeam>(returnResult.result);
                            if (s.Ls == LoginState.selectSingleTeamJoin)
                            {
                                {
                                    string command_start;
                                    {
                                        //将状态设置为等待开始和等待加入
                                        s = await Room.setState(s, webSocket, LoginState.WaitingToGetTeam);
                                    }
                                    {
                                        returnResult = await ReceiveStringAsync(webSocket, webWsSize);

                                        wResult = returnResult.wr;
                                        var teamID = returnResult.result;
                                        command_start = CommonClass.Random.GetMD5HashFromStr(s.WebsocketID.ToString() + s.WebsocketID + DateTime.Now.ToString());
                                        var result = await Team.findTeam2(s.WebsocketID, playerName, command_start, teamID);

                                        if (result == "ok")
                                        {
                                            returnResult = await ReceiveStringAsync(webSocket, webWsSize);

                                            wResult = returnResult.wr;

                                            int roomIndex;
                                            if (Room.CheckSecret(returnResult.result, command_start, out roomIndex))
                                            {
                                                s = await Room.GetRoomThenStartAfterJoinTeam(s, webSocket, roomIndex, playerName, carsNames);
                                            }
                                            else
                                            {
                                                return;
                                            }
                                        }
                                        else if (result == "game has begun")
                                        {
                                            s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);

                                            await Room.Alert(webSocket, $"他们已经开始了!");
                                        }
                                        else if (result == "is not number")
                                        {
                                            s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);

                                            await Room.Alert(webSocket, $"请输入数字");
                                        }
                                        else if (result == "not has the team")
                                        {
                                            s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);

                                            await Room.Alert(webSocket, $"没有该队伍({teamID})");
                                        }
                                        else if (result == "team is full")
                                        {
                                            s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);

                                            await Room.Alert(webSocket, "该队伍已满员");
                                        }
                                        else
                                        {
                                            s = await Room.setState(s, webSocket, LoginState.selectSingleTeamJoin);
                                        }
                                    }
                                }
                            }
                        }; break;

                        case "SetCarsName":
                        {
                            if (s.Ls == LoginState.selectSingleTeamJoin)
                            {
                                SetCarsName setCarsName = Newtonsoft.Json.JsonConvert.DeserializeObject <SetCarsName>(returnResult.result);
                                for (var i = 0; i < 5; i++)
                                {
                                    if (!string.IsNullOrEmpty(setCarsName.Names[i]))
                                    {
                                        if (setCarsName.Names[i].Trim().Length >= 2 && setCarsName.Names[i].Trim().Length < 7)
                                        {
                                            carsNames[i] = setCarsName.Names[i].Trim();
                                        }
                                    }
                                }
                            }
                        }; break;

                        case "GetCarsName":
                        {
                            if (s.Ls == LoginState.selectSingleTeamJoin)
                            {
                                var msg      = Newtonsoft.Json.JsonConvert.SerializeObject(new { c = "GetCarsName", names = carsNames });
                                var sendData = Encoding.UTF8.GetBytes(msg);
                                await webSocket.SendAsync(new ArraySegment <byte>(sendData, 0, sendData.Length), WebSocketMessageType.Text, true, CancellationToken.None);
                            }
                        }; break;

                        case "SetPlayerName":
                        {
                            if (s.Ls == LoginState.selectSingleTeamJoin)

                            {
                                SetPlayerName setPlayerName = Newtonsoft.Json.JsonConvert.DeserializeObject <SetPlayerName>(returnResult.result);
                                playerName = setPlayerName.Name;
                            }
                        }; break;

                        case "GetName":
                        {
                            if (s.Ls == LoginState.selectSingleTeamJoin)

                            {
                                var msg      = Newtonsoft.Json.JsonConvert.SerializeObject(new { c = "GetName", name = playerName });
                                var sendData = Encoding.UTF8.GetBytes(msg);
                                await webSocket.SendAsync(new ArraySegment <byte>(sendData, 0, sendData.Length), WebSocketMessageType.Text, true, CancellationToken.None);
                            }
                        }; break;

                        //case "SetCarName":
                        //    {
                        //        if (s.Ls == LoginState.selectSingleTeamJoin)
                        //        {
                        //            SetCarName setCarName = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCarName>(returnResult.result);
                        //            if (setCarName.Name.Trim().Length < 7 && setCarName.Name.Trim().Length > 1)
                        //            {
                        //                if (setCarName.CarIndex >= 0 && setCarName.CarIndex < 5)
                        //                {
                        //                    carsNames[setCarName.CarIndex] = setCarName.Name;
                        //                }
                        //            }
                        //            //playerName = setPlayerName.Name;
                        //        }
                        //    }; break;
                        case "Promote":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Promote promote = Newtonsoft.Json.JsonConvert.DeserializeObject <Promote>(returnResult.result);

                                await Room.setPromote(s, promote);
                            }
                        }; break;

                        case "Collect":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Collect collect = Newtonsoft.Json.JsonConvert.DeserializeObject <Collect>(returnResult.result);

                                await Room.setCollect(s, collect);
                            }
                        }; break;

                        case "Attack":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Attack attack = Newtonsoft.Json.JsonConvert.DeserializeObject <Attack>(returnResult.result);
                                await Room.setAttack(s, attack);
                            }
                        }; break;

                        case "Tax":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Tax tax = Newtonsoft.Json.JsonConvert.DeserializeObject <Tax>(returnResult.result);
                                await Room.setToCollectTax(s, tax);
                            }
                        }; break;

                        case "Msg":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Msg msg = Newtonsoft.Json.JsonConvert.DeserializeObject <Msg>(returnResult.result);
                                if (msg.MsgPass.Length < 120)
                                {
                                    await Room.passMsg(s, msg);
                                }
                            }
                        }; break;

                        case "Ability":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Ability a = Newtonsoft.Json.JsonConvert.DeserializeObject <Ability>(returnResult.result);
                                await Room.setCarAbility(s, a);
                            }
                        }; break;

                        case "SetCarReturn":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                SetCarReturn scr = Newtonsoft.Json.JsonConvert.DeserializeObject <SetCarReturn>(returnResult.result);
                                await Room.setCarReturn(s, scr);
                            }
                        }; break;

                        case "Donate":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Donate donate = Newtonsoft.Json.JsonConvert.DeserializeObject <Donate>(returnResult.result);
                                await Room.Donate(s, donate);
                            }
                        }; break;

                        case "GetSubsidize":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                GetSubsidize getSubsidize = Newtonsoft.Json.JsonConvert.DeserializeObject <GetSubsidize>(returnResult.result);
                                await Room.GetSubsidize(s, getSubsidize);
                            }
                        }; break;

                        case "OrderToSubsidize":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                GetSubsidize getSubsidize = Newtonsoft.Json.JsonConvert.DeserializeObject <GetSubsidize>(returnResult.result);
                                await Room.GetSubsidize(s, getSubsidize);
                            }
                        }; break;

                        case "Bust":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Bust bust = Newtonsoft.Json.JsonConvert.DeserializeObject <Bust>(returnResult.result);
                                await Room.setBust(s, bust);
                            }
                        }; break;

                        case "BuyDiamond":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                BuyDiamond bd = Newtonsoft.Json.JsonConvert.DeserializeObject <BuyDiamond>(returnResult.result);
                                await Room.buyDiamond(s, bd);
                            }
                        }; break;

                        case "SellDiamond":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                BuyDiamond bd = Newtonsoft.Json.JsonConvert.DeserializeObject <BuyDiamond>(returnResult.result);
                                await Room.sellDiamond(s, bd);
                            }
                        }; break;

                        case "DriverSelect":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                DriverSelect ds = Newtonsoft.Json.JsonConvert.DeserializeObject <DriverSelect>(returnResult.result);
                                await Room.selectDriver(s, ds);
                            }
                        }; break;

                        case "Skill1":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Skill1 s1 = Newtonsoft.Json.JsonConvert.DeserializeObject <Skill1>(returnResult.result);
                                await Room.magic(s, s1);
                            }
                        }; break;

                        case "Skill2":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                Skill2 s2 = Newtonsoft.Json.JsonConvert.DeserializeObject <Skill2>(returnResult.result);
                                await Room.magic(s, s2);
                            }
                        }; break;

                        case "ViewAngle":
                        {
                            if (s.Ls == LoginState.OnLine)
                            {
                                ViewAngle va = Newtonsoft.Json.JsonConvert.DeserializeObject <ViewAngle>(returnResult.result);
                                await Room.view(s, va);
                            }
                        }; break;
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"{ Newtonsoft.Json.JsonConvert.SerializeObject(e)}");
                        await Room.setOffLine(s);

                        removeWs(s.WebsocketID);
                        // Console.WriteLine($"step2:webSockets数量:{   BufferImage.webSockets.Count}");
                        // return;
                        throw e;
                    }
                }while (!wResult.CloseStatus.HasValue);
                await Room.setOffLine(s);

                removeWs(s.WebsocketID);
                //try
                //{
                //    // await webSocket.CloseAsync(wResult.CloseStatus.Value, wResult.CloseStatusDescription, CancellationToken.None);
                //    // ConnectInfo.connectedWs.Remove(c.WebSocketID);

                //}
                //catch (Exception e)
                //{
                //    throw e;
                //    // ConnectInfo.connectedWs.Remove(c.WebSocketID);
                //    //  return;
                //}
            };
        }
예제 #16
0
 public void UpdateToDB()
 {
     GameDB.Instance.UpdateRole(id.ToString(), ((int)type).ToString(), ((int)style).ToString(), Level.ToString(),
                                Name, Skill1.ToString(), Skill2.ToString(), Skill3.ToString(), Skill4.ToString(), Skill5.ToString(), Skill6.ToString(), Skill7.ToString(), UsedSkillIndex);
 }