예제 #1
0
    public void onAvatarEnterWorld(UInt64 rndUUID, Int32 eid, KBEngine.Avatar avatar)
    {
        if (!avatar.isPlayer())
        {
            return;
        }
        createPlayer();
        //UI.inst.info("loading scene...(加载场景中...)");
        Debug.Log("loading scene...");

        //object speed = avatar.getDefinedProperty("moveSpeed");
        //if (speed != null)
        //    set_moveSpeed(avatar, speed);

        object state = avatar.getDefinedProperty("state");

        if (state != null)
        {
            set_state(avatar, state);
        }

        //object modelScale = avatar.getDefinedProperty("modelScale");
        //if (modelScale != null)
        //    set_modelScale(avatar, modelScale);

        object name = avatar.getDefinedProperty("name");

        if (name != null)
        {
            set_entityName(avatar, (string)name);
        }

        object hp = avatar.getDefinedProperty("HP");

        if (hp != null)
        {
            set_HP(avatar, hp);
        }

        object hpMax = avatar.getDefinedProperty("HP_Max");

        if (hpMax != null)
        {
            set_HP_Max(avatar, hpMax);
        }

        //设置头像属性
        UnityEngine.GameObject ptarget = UnityEngine.GameObject.FindGameObjectWithTag("TargetPlayer");

        if (ptarget)
        {
            ui_targetPlayer = ptarget.GetComponent <UI_Target>();
        }
        if (ui_targetPlayer)
        {
            ui_targetPlayer.GE_target = player.GetComponent <GameEntity>();
            ui_targetPlayer.UpdateTargetUI();
        }
        //end
        UnityEngine.GameObject canvas      = UnityEngine.GameObject.FindGameObjectWithTag("Canvas");
        UnityEngine.GameObject panel_state = null;
        if (canvas.transform.Find("Panel - State") != null)
        {
            panel_state = canvas.transform.Find("Panel - State").gameObject;
        }
        if (panel_state != null)
        {
            UI_AvatarState avaterState = panel_state.GetComponent <UI_AvatarState>();
            object         attack_max  = avatar.getDefinedProperty("attack_Max");
            if (attack_max != null)
            {
                avaterState.setAttackMax((Int32)attack_max);
            }

            object attack_min = avatar.getDefinedProperty("attack_Min");
            if (attack_min != null)
            {
                avaterState.setAttackMin((Int32)attack_min);
            }

            object defence = avatar.getDefinedProperty("defence");
            if (defence != null)
            {
                avaterState.setDefence((Int32)defence);
            }

            object rating = avatar.getDefinedProperty("rating");
            if (rating != null)
            {
                avaterState.setRating((Int32)rating);
            }

            object dodge = avatar.getDefinedProperty("dodge");
            if (dodge != null)
            {
                avaterState.setDodge((Int32)dodge);
            }

            object strength = avatar.getDefinedProperty("strength");
            if (strength != null)
            {
                avaterState.setStrength((Int32)strength);
            }

            object dexterity = avatar.getDefinedProperty("dexterity");
            if (dexterity != null)
            {
                avaterState.setDexterity((Int32)dexterity);
            }

            object stamina = avatar.getDefinedProperty("stamina");
            if (stamina != null)
            {
                avaterState.setStamina((Int32)stamina);
            }

            object exp = avatar.getDefinedProperty("exp");
            if (exp != null)
            {
                avaterState.setExp((UInt64)exp);
            }

            object level = avatar.getDefinedProperty("level");
            if (level != null)
            {
                avaterState.setLevel((UInt16)level);
            }
        }

        object equipWeapon = avatar.getDefinedProperty("equipWeapon");

        if (equipWeapon != null)
        {
            set_equipWeapon(avatar, (Int32)equipWeapon);
        }

        SkillBox.inst.initSkillDisplay();
    }