コード例 #1
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
 private void RpcLoadActionBarFromDatabase(string actionBar, string playerName)
 {
     if (GameObject.Find("LocalPlayer").GetComponent <PlayerRpg>().playerName.Equals(playerName))
     {
         GlobalSerialization.DeserializeActionBar(actionBar, SerializationDatabase.instance.inventory, SerializationDatabase.instance.abs);
     }
 }
コード例 #2
0
    private void TestSpAquisitionSerialization()
    {
        bool[,] tab = new bool[99, 3];

        int counter = 29;

        for (int i = 0; i < 99; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (counter > 0)
                {
                    tab[i, j] = true;
                    counter--;
                }
                else
                {
                    tab[i, j] = false;
                }
            }
        }

        Debug.Log(tab);
        string serial = GlobalSerialization.SerializeSpAquisitionTable(tab);

        Debug.Log(serial);
        bool[,] deserializedTab = GlobalSerialization.DeserializeSpAquisitionTable(serial);
        Debug.Log(deserializedTab);
    }
コード例 #3
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
 private void RpcLoadItemFromDatabase(int id, int x, int y, int upgrade, int quantity, string playerName)
 {
     if (GameObject.Find("LocalPlayer").GetComponent <PlayerRpg>().playerName.Equals(playerName))
     {
         GlobalSerialization.DeserializeItem(new SerialItem(id, x, y, upgrade, quantity), SerializationDatabase.instance.inventory);
     }
 }
コード例 #4
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
 public void CallCmdSerializePlayerPosition()
 {
     if (isLocalPlayer)
     {
         SerialPosition spos = GlobalSerialization.SerializePosition(gameObject);
         CmdSerializePlayerPosition(spos.posX, spos.posY, spos.rotZ, GetComponent <PlayerRpg>().playerName);
     }
 }
コード例 #5
0
    private void SerializeItems()
    {
        serializedItems = new List <SerialItem>();

        for (int i = 0; i < itemsParentObject.transform.childCount; i++)
        {
            serializedItems.Add(GlobalSerialization.SerializeItem(itemsParentObject.transform.GetChild(i).GetComponent <ItemUI>()));
        }
    }
コード例 #6
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
    private void RpcLoadPositionFromDatabase(float x, float y, float z, string playerName)
    {
        PlayerRpg localPlayer = GameObject.Find("LocalPlayer").GetComponent <PlayerRpg>();

        if (localPlayer.playerName.Equals(playerName))
        {
            GlobalSerialization.DeserializePosition(new SerialPosition(x, y, z), localPlayer.gameObject);
        }
    }
コード例 #7
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
 public void CallCmdSerializePlayerRpg()
 {
     if (isLocalPlayer)
     {
         SerialPlayerRpg spr = GlobalSerialization.SerializePlayerRpg(GetComponent <PlayerRpg>());
         CmdSerializePlayerRpg(spr.cName, spr.yang, spr.level, spr.exp,
                               spr.sPoints, spr.sPointsTab, spr.cHp, spr.cEn, spr.cSt,
                               spr.bVit, spr.bInt, spr.bStr, spr.bDex, GetComponent <PlayerRpg>().playerName);
     }
 }
コード例 #8
0
ファイル: PlayerNetwork.cs プロジェクト: zukerr/hidden-realm
    private void RpcLoadPlayerRpgFromDatabase(string cName, long yang, int level, long exp,
                                              int sPoints, string sPointsTab, float cHp, float cEn, float cSt,
                                              int bVit, int bInt, int bStr, int bDex, string playerName)
    {
        PlayerRpg localPlayer = GameObject.Find("LocalPlayer").GetComponent <PlayerRpg>();

        if (localPlayer.playerName.Equals(playerName))
        {
            GlobalSerialization.DeserializePlayerRpg(new SerialPlayerRpg(cName,
                                                                         yang, level, exp, sPoints, sPointsTab, cHp, cEn, cSt, bVit, bInt, bStr, bDex), localPlayer);
            localPlayer.SetupStatusAfterLoad();
        }
    }
コード例 #9
0
    public void SetupSerializedValues(SerialPlayerRpg spr)
    {
        CmdSetName(spr.cName);
        Yang  = spr.yang;
        Level = spr.level;
        RefreshMaxExp();
        Exp                = spr.exp;
        StatusPoints       = spr.sPoints;
        spAcquisitionTable = GlobalSerialization.DeserializeSpAquisitionTable(spr.sPointsTab);

        BaseVit = spr.bVit;
        BaseInt = spr.bInt;
        BaseStr = spr.bStr;
        BaseDex = spr.bDex;
        CalculateStatsDerivatives();

        CmdManipulateHealth(spr.cHp);
        Energy  = spr.cEn;
        Stamina = spr.cSt;
    }
コード例 #10
0
 //this is called on clients, assigned to button for tests
 public void SaveItemsToDatabase()
 {
     inventory.GetPlayerRpg().gameObject.GetComponent <PlayerNetwork>().CallCmdClearItemsOfPlayer();
     SerializeItems();
     foreach (SerialItem sitem in serializedItems)
     {
         inventory.GetPlayerRpg().gameObject.GetComponent <PlayerNetwork>().SerializeItem(sitem);
     }
     inventory.GetPlayerRpg().gameObject.GetComponent <PlayerNetwork>().CallCmdSerializeActionBar(GlobalSerialization.SerializeActionBar(abs));
     inventory.GetPlayerRpg().gameObject.GetComponent <PlayerNetwork>().CallCmdSerializePlayerPosition();
     inventory.GetPlayerRpg().gameObject.GetComponent <PlayerNetwork>().CallCmdSerializePlayerRpg();
 }