private bool Login(int playerUniqueID)
        {
            if (server.wandererDictionary.ContainsKey(guid))
            {
                string[] requestItem = new string[4];
                requestItem[0] = "Account";
                requestItem[1] = "Inventory";
                requestItem[2] = "Appliances";
                requestItem[3] = "Money";

                string[] returnData = server.database.GetDataByUniqueID(playerUniqueID, requestItem, "player");

                if (returnData[1] != "" && returnData[2] != "")
                {
                    player = new REPlayer(playerUniqueID, returnData[0], returnData[1], returnData[2], int.Parse(returnData[3]), this);
                }
                else
                {
                    player = new REPlayer(playerUniqueID, returnData[0], this);
                }
                workRoom = new Room("工作小屋");
                server.PlayerOnline(player);
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #2
0
 public void PlayerOffline(REPlayer player)
 {
     playerDictionary.Remove(player.uniqueID);
     string[] updateItems = { "Inventory", "Appliances", "Money" };
     object[] updateValues = {
             JsonConvert.SerializeObject(player.inventory, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }),
             JsonConvert.SerializeObject(player.appliances, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }),
             player.money
         };
     string table = "player";
     database.UpdateDataByUniqueID(player.uniqueID, updateItems, updateValues, table);
 }
Beispiel #3
0
 public void PlayerOnline(REPlayer player)
 {
     wandererDictionary.Remove(player.peer.guid);
     playerDictionary.Add(player.uniqueID, player);
 }