Exemple #1
0
    public void previewCharacter(PlayerData.Character prCharacter)
    {
        // UI Detail
        characterName.GetComponent <Text>().text  = prCharacter.GetCharacterName();
        characterMoney.GetComponent <Text>().text = prCharacter.GetMoney() + "";
        string detail = ToThaiJob(prCharacter.GetJob()) + "\r\n" +
                        prCharacter.GetLevel() + "\r\n" +
                        prCharacter.GetHP() + "/" + prCharacter.GetMaxHP() + "\r\n" +
                        prCharacter.GetSP() + "/" + prCharacter.GetMaxSP() + "\r\n" +
                        prCharacter.GetEXP() + "\r\n" +
                        prCharacter.GetATK() + "\r\n" +
                        prCharacter.GetDEF() + "\r\n";

        characterDetail.GetComponent <Text>().text = detail;
        // Active preview character
        transform.GetChild(2).gameObject.SetActive(true);
        PlayerAnimation pa = transform.GetChild(2).GetComponent <PlayerAnimation>();

        pa.genderData   = prCharacter.GetGender();
        pa.jobData      = prCharacter.GetJob();
        pa.hairData     = prCharacter.GetHeadEquipment();
        pa.clothData    = prCharacter.GetBodyEquipment();
        pa.shoeData     = pa.clothData;
        selectCharacter = prCharacter;
        //Detail
        uiChoose.transform.GetChild(1).gameObject.SetActive(true);
        //Confirm button
        uiChoose.transform.GetChild(2).gameObject.SetActive(true);
        //Create button
        uiChoose.transform.GetChild(3).gameObject.SetActive(false);
        //Delete button
        //uiChoose.transform.GetChild(4).gameObject.SetActive(true);
    }
    // 21017
    public void ReceiveCharacterCreated(PlayerData.Character character)
    {
        PlayerData pd = mainController.gameObject.GetComponent <PlayerData>();

        pd.AddCharacter(character);
        //notification > Create success
        Popup.Instance.showPopup("การสร้างตัวละคร", "สร้างตัวละครสำเร็จ !");
        // Move camera to Choose Character
        GameObject sam = GameObject.Find("Screen Action Manager");

        sam.GetComponent <Animator>().Play("goChooseCharacter");
        // Set preview Character
        sam.transform.GetChild(0).GetComponent <ChooseCharacter>().previewCharacter(character);
    }
Exemple #3
0
    // 21017
    private void RecvCharacterCreateSuccess(int packet_id, PacketReader pr)
    {
        string name = pr.ReadString();

        PlayerData.Character character = new PlayerData.Character(name);
        // Status
        string gender = pr.ReadString();
        string job    = pr.ReadString();
        int    level  = pr.ReadInt8();
        int    exp    = pr.ReadInt32();
        int    hp     = pr.ReadInt32();
        int    sp     = pr.ReadInt32();
        int    maxEXP = pr.ReadInt32();
        int    maxHp  = pr.ReadInt32();
        int    maxSp  = pr.ReadInt32();
        int    atk    = pr.ReadInt32();
        int    def    = pr.ReadInt32();

        character.SetStatus(gender, job, level, exp, hp, sp, maxEXP, maxHp, maxSp, atk, def);
        // Equipment
        string headEquipment   = pr.ReadString();
        string bodyEquipment   = pr.ReadString();
        string weaponEquipment = pr.ReadString();

        character.SetEquipment(headEquipment, bodyEquipment, weaponEquipment);
        // Location
        string currentMap = pr.ReadString();
        float  positionX  = pr.ReadFloat();
        float  positionY  = pr.ReadFloat();

        character.SetLocation(currentMap, positionX, positionY);
        // Inventory
        int money = pr.ReadInt32();

        character.SetMoney(money);

        /*Debug.Log("Character name : " + name);
         * Debug.Log("Job : " + job + ", Lvl." + level + " EXP." + exp);
         * Debug.Log("HP : " + hp + "/" + maxHp + ",  SP : " + sp +"/"+maxSp );
         * Debug.Log("Attack : " + atk + " , Defense : " + def);
         * Debug.Log("[Equipment] Head : " + headEquipment + ", Body : "+bodyEquipment+", Weapon : "+weaponEquipment);
         * Debug.Log("[Location] Map : " + currentMap + " X : " + positionX + " Y : " + positionY);
         * Debug.Log("Inventory");
         * Debug.Log("Gold : " + gold);
         * Debug.Log("Item [" + itemAmount + "]");*/
        DGTRemote.GetInstance().ReceiveCharacterCreated(character);
    }
Exemple #4
0
    // 21014
    private void RecvAccountData(int packet_id, PacketReader pr)
    {
        int accountId = pr.ReadInt32();

        Debug.Log("Recieve Account Data id : " + accountId);
        int characterAmount = pr.ReadInt8();

        PlayerData.Character[] characters = null;
        if (characterAmount > 0)
        {
            characters = new PlayerData.Character[characterAmount];
            for (int i = 0; i < characterAmount; i++)   // for each character
            {
                string name = pr.ReadString();
                characters[i] = new PlayerData.Character(name);
                // Status
                string gender = pr.ReadString();
                string job    = pr.ReadString();
                int    level  = pr.ReadInt8();
                int    exp    = pr.ReadInt32();
                int    hp     = pr.ReadInt32();
                int    sp     = pr.ReadInt32();
                int    maxEXP = pr.ReadInt32();
                int    maxHp  = pr.ReadInt32();
                int    maxSp  = pr.ReadInt32();
                int    atk    = pr.ReadInt32();
                int    def    = pr.ReadInt32();
                characters[i].SetStatus(gender, job, level, exp, hp, sp, maxEXP, maxHp, maxSp, atk, def);
                // Equipment
                string headEquipment   = pr.ReadString();
                string bodyEquipment   = pr.ReadString();
                string weaponEquipment = pr.ReadString();
                characters[i].SetEquipment(headEquipment, bodyEquipment, weaponEquipment);
                // Location
                string currentMap = pr.ReadString();
                float  positionX  = pr.ReadFloat();
                float  positionY  = pr.ReadFloat();
                characters[i].SetLocation(currentMap, positionX, positionY);
                // Inventory
                int money = pr.ReadInt32();
                characters[i].SetMoney(money);
                int itemAmount = pr.ReadInt8();

                /*Debug.Log("Character name : " + name);
                 * Debug.Log("Job : " + job + ", Lvl." + level + " EXP." + exp);
                 * Debug.Log("HP : " + hp + "/" + maxHp + ",  SP : " + sp +"/"+maxSp );
                 * Debug.Log("Attack : " + atk + " , Defense : " + def);
                 * Debug.Log("[Equipment] Head : " + headEquipment + ", Body : "+bodyEquipment+", Weapon : "+weaponEquipment);
                 * Debug.Log("[Location] Map : " + currentMap + " X : " + positionX + " Y : " + positionY);
                 * Debug.Log("Inventory");
                 * Debug.Log("Gold : " + gold);
                 * Debug.Log("Item [" + itemAmount + "]");*/
                /* Receive Item*/
                if (itemAmount > 0)
                {
                    for (int j = 0; j < itemAmount; j++)
                    {
                        int itemId = pr.ReadInt32();
                        int amount = pr.ReadInt16();
                        //Debug.Log("Item id : " + itemId + ", " + amount + "ea");
                        characters[i].ListItemToInventoryList(itemId, amount);
                    }
                }
                else
                {
                    //Debug.Log("No item in inventory");
                }
                // QUEST
                int questSuccessAmount = pr.ReadUInt16();
                Debug.Log("Quest Success : " + questSuccessAmount);
                if (questSuccessAmount > 0)
                {
                    for (int j = 0; j < questSuccessAmount; j++)
                    {
                        characters[i].AddQuestSuccessList(pr.ReadUInt16());
                    }
                }
                int questProcessAmount = pr.ReadUInt16();
                if (questProcessAmount > 0)
                {
                    for (int j = 0; j < questProcessAmount; j++)
                    {
                        characters[i].AddQuestProcessList(pr.ReadUInt16(), pr.ReadUInt16());
                    }
                }
                // Checkin
                int checkinAmount = pr.ReadUInt8();
                if (checkinAmount > 0)
                {
                    for (int j = 0; j < checkinAmount; j++)
                    {
                        characters[i].AddCheckinList(pr.ReadUInt8(), pr.ReadString());
                    }
                }
            }
            // Done character
            DGTRemote.GetInstance().ReceiveAccountData(accountId, characters);
        }
        else
        {
            DGTRemote.GetInstance().ReceiveAccountData(accountId, null);
        }
    }