//加载对应模型的基础职业骨架 FakeObject
        public GameObject NewFakeObject(int localId)
        {
            //每次显示都要初始化一下FakeObj的装备信息
            if (fakeObjects.ContainsKey(localId))
            {
                //fakeObjects [localId].GetComponent<NpcEquipment> ().InitDefaultEquip();
                fakeObjects [localId].GetComponent <NpcEquipment>().InitFakeEquip();
                return(fakeObjects [localId]);
            }

            var player = GetLocalPlayer(localId);
            var job    = player.GetComponent <NpcAttribute>().ObjUnitData.job;

            Log.Sys("DialogPlayer is " + job.ToString());
            //var fakeObject = Instantiate (Resources.Load<GameObject> ("DialogPlayer/" + job.ToString ())) as GameObject;
            var fakeObject = SelectChar.ConstructChar(job);

            fakeObject.name = fakeObject.name + "_fake";


            fakeObject.SetActive(false);
            fakeObjects [localId] = fakeObject;
            fakeObject.GetComponent <NpcEquipment>().SetFakeObj();
            fakeObject.GetComponent <NpcEquipment>().SetLocalId(localId);
            fakeObject.GetComponent <NpcEquipment>().InitFakeEquip();

            Util.SetLayer(fakeObject, GameLayer.PlayerCamera);
            return(fakeObject);
        }
Exemple #2
0
        //何时删除FakeObject对象



        //UI显示FakeObject
        public void OnUIShown(int localId, RolesInfo roleInfo, int job = -1)
        {
            Log.GUI("UI Show Local ID" + localId);
            if (dialogPlayer != null)
            {
                dialogPlayer.SetActive(false);
                dialogPlayer = null;
            }

            //选择人物界面显示的人物模型
            if (roleInfo != null)
            {
                dialogPlayer = SelectChar.ConstructChar(roleInfo);
                dialogPlayer.SetActive(true);
                dialogPlayer.transform.parent        = rotPlayer.transform;
                dialogPlayer.transform.localPosition = Vector3.zero;
                dialogPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
                dialogPlayer.transform.localScale    = Vector3.one;
                Util.SetLayer(dialogPlayer, GameLayer.PlayerCamera);

                playerWindow.SetActive(true);
                //创建人物界面显示的模型
            }
            else if (job != -1)
            {
                dialogPlayer = SelectChar.ConstructChar((Job)job);
                dialogPlayer.SetActive(true);
                dialogPlayer.transform.parent        = rotPlayer.transform;
                dialogPlayer.transform.localPosition = Vector3.zero;
                dialogPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
                dialogPlayer.transform.localScale    = Vector3.one;
                Util.SetLayer(dialogPlayer, GameLayer.PlayerCamera);

                playerWindow.SetActive(true);
                //背包UI界面显示的人物模型
            }
            else
            {
                Log.GUI("UI Show Object " + localId);
                dialogPlayer = ObjectManager.objectManager.NewFakeObject(localId);
                dialogPlayer.SetActive(true);
                dialogPlayer.transform.parent        = rotPlayer.transform;
                dialogPlayer.transform.localPosition = Vector3.zero;
                dialogPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
                dialogPlayer.transform.localScale    = Vector3.one;
                playerWindow.SetActive(true);
            }
        }
Exemple #3
0
        //何时删除FakeObject对象



        //UI显示FakeObject
        public void OnUIShown(int localId, RolesInfo roleInfo, int job = -1)
        {
            Log.GUI("UI Show Local ID" + localId);
            if (dialogPlayer != null)
            {
                //dialogPlayer.SetActive(false);
                GameObject.Destroy(dialogPlayer);
                dialogPlayer = null;
            }

            if (dialogDetailPlayer != null)
            {
                //dialogPlayer.SetActive(false);
                GameObject.Destroy(dialogDetailPlayer);
                dialogDetailPlayer = null;
            }

            //选择人物界面显示的人物模型
            if (roleInfo != null)
            {
                dialogPlayer = SelectChar.ConstructChar(roleInfo);
                dialogPlayer.SetActive(true);
                dialogPlayer.transform.parent        = rotPlayer.transform;
                dialogPlayer.transform.localPosition = Vector3.zero;
                dialogPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
                dialogPlayer.transform.localScale    = Vector3.one;
                Util.SetLayer(dialogPlayer, GameLayer.PlayerCamera);

                playerWindow.SetActive(true);
                //创建人物界面显示的模型
            }             /*else if (job != -1) {
                           *    dialogPlayer = SelectChar.ConstructChar ((Job)job);
                           *    dialogPlayer.SetActive (true);
                           *    dialogPlayer.transform.parent = rotPlayer.transform;
                           *    dialogPlayer.transform.localPosition = Vector3.zero;
                           *    dialogPlayer.transform.localRotation = Quaternion.Euler (new Vector3 (0, 180, 0));
                           *    dialogPlayer.transform.localScale = Vector3.one;
                           *    Util.SetLayer (dialogPlayer, GameLayer.PlayerCamera);
                           *
                           *    playerWindow.SetActive (true);
                           *    //背包UI界面显示的人物模型
                           * }*/
            else if (job == 1)
            {
                dialogPlayer = SelectChar.ConstructChar((Job)job);
                dialogPlayer.SetActive(true);
                dialogPlayer.transform.parent        = rotPlayer.transform;
                dialogPlayer.transform.localPosition = Vector3.zero;
                dialogPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
                dialogPlayer.transform.localScale    = Vector3.one;
                Util.SetLayer(dialogPlayer, GameLayer.PlayerCamera);

                playerWindow.SetActive(true);
            }
            else if (job == 2)
            {
                dialogDetailPlayer = SelectChar.ConstructChar((Job)1);
                dialogDetailPlayer.SetActive(true);
                Debug.LogError(dialogDetailPlayer.name);
                dialogDetailPlayer.transform.parent        = rotDetailPlayer.transform;
                dialogDetailPlayer.transform.localPosition = Vector3.zero;
                dialogDetailPlayer.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));

                Util.SetLayer(dialogDetailPlayer, GameLayer.PlayerCamera);
                dialogDetailPlayer.transform.localScale = Vector3.one;
                playerDetailWindow.SetActive(true);
            }
        }