示例#1
0
        public void doNext()
        {
            if (fake_npc != null)
            {
                fake_npc = null;
                InterfaceMgr.getInstance().close(InterfaceMgr.DIALOG);
                return;
            }

            closeSubWins();

            if ((curIdx + 1) >= m_desc.Count)
            {
                isLastDesc = true;
            }
            else
            {
                isLastDesc = false;
            }


            if (curIdx >= m_desc.Count)
            {
                if (m_handle != null)
                {
                    m_handle();
                }
                InterfaceMgr.getInstance().close(InterfaceMgr.DIALOG);
            }
            else
            {
                showDesc(m_desc[curIdx]);
                curIdx++;
            }
        }
示例#2
0
        public void addRole(NpcRole npc)
        {
            bool flag = this.dNpc.ContainsKey(npc.id);

            if (!flag)
            {
                this.dNpc[npc.id] = npc;
                this.CheckNpcTaskState(npc);
            }
        }
示例#3
0
        public void addRole(NpcRole npc)
        {
            if (dNpc.ContainsKey(npc.id))
            {
                return;
            }

            dNpc[npc.id] = npc;

            CheckNpcTaskState(npc);
        }
示例#4
0
        private void OnNpcTaskStateChange(GameEvent e)
        {
            Variant data = e.data;

            int npcId     = data["npcId"];
            int taskId    = data["taskId"];
            int taskState = data["taskState"];

            if (!dicNpcTaskState.ContainsKey(npcId))
            {
                Dictionary <int, int> dicTemp = new Dictionary <int, int>();
                dicTemp[taskId]        = taskState;
                dicNpcTaskState[npcId] = dicTemp;
            }
            else
            {
                if (taskState == 0)
                {
                    dicNpcTaskState[npcId].Remove(taskId);
                }
                else
                {
                    dicNpcTaskState[npcId][taskId] = taskState;
                }
            }

            NpcRole nRole = getRole(npcId);

            List <int> listState = dicNpcTaskState[npcId].Values.ToList <int>();
            int        state     = 0;

            if (listState.Count > 0)
            {
                state = listState.Max <int>();
            }

            SetNpcTaskState(nRole, (NpcTaskState)state);
            TaskData taskData = A3_TaskModel.getInstance().GetTaskDataById(taskId);

            if (taskData != null)
            {
                if (taskData.topShowOnLiteminimap)//#判空处理

                {
                    a3_liteMinimap.instance?.SetTopShow(taskId);
                }

                else
                {
                    a3_liteMinimap.instance?.RefreshTaskPage(taskId);
                }
            }
        }
示例#5
0
        //检查npc的任务状态
        private void CheckNpcTaskState(NpcRole npc)
        {
            int npcid = npc.id;

            if (dicNpcTaskState.ContainsKey(npcid))
            {
                Dictionary <int, int> taskState = dicNpcTaskState[npcid];

                List <int> listState = taskState.Values.ToList <int>();
                int        state     = 0;
                if (listState.Count > 0)
                {
                    state = listState.Max <int>();
                }
                SetNpcTaskState(npc, (NpcTaskState)state);
            }
        }
示例#6
0
        private void CheckNpcTaskState(NpcRole npc)
        {
            int  id   = npc.id;
            bool flag = this.dicNpcTaskState.ContainsKey(id);

            if (flag)
            {
                Dictionary <int, int> dictionary = this.dicNpcTaskState[id];
                List <int>            list       = dictionary.Values.ToList <int>();
                int  taskState = 0;
                bool flag2     = list.Count > 0;
                if (flag2)
                {
                    taskState = list.Max <int>();
                }
                this.SetNpcTaskState(npc, (NpcTaskState)taskState);
            }
        }
示例#7
0
        public void SetNpcTaskState(NpcRole npc, NpcTaskState taskState)
        {
            bool flag = npc == null;

            if (!flag)
            {
                int id = npc.id;
                npc.refreshTaskIcon(taskState);
                bool flag2 = taskState > NpcTaskState.NONE;
                if (flag2)
                {
                    npc.listTaskId = this.dicNpcTaskState[npc.id].Keys.ToList <int>();
                }
                else
                {
                    npc.listTaskId = null;
                }
            }
        }
示例#8
0
        public static void showTalk(List <string> desc, Action handle, NpcRole npc, bool isfake = false)
        {
            bool flag = desc == null;

            if (!flag)
            {
                if (isfake)
                {
                    dialog.fake_npc  = npc;
                    dialog.fake_desc = desc[0];
                }
                else
                {
                    dialog.m_handle = handle;
                    dialog.m_desc   = desc;
                    dialog.m_npc    = npc;
                }
                InterfaceMgr.getInstance().open(InterfaceMgr.DIALOG, null, false);
            }
        }
示例#9
0
        public static void showTalk(List <string> desc, Action handle, NpcRole npc, bool isfake = false)
        {
            if (desc == null)
            {
                return;
            }

            if (isfake)
            {
                fake_npc  = npc;
                fake_desc = desc[0];
            }
            else
            {
                m_handle = handle;
                m_desc   = desc;
                m_npc    = npc;
            }

            InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.DIALOG);
        }
示例#10
0
        //设置npc的任务状态
        public void SetNpcTaskState(NpcRole npc, NpcTaskState taskState)
        {
            if (npc == null)
            {
                return;
            }

            int npcId = npc.id;

            npc.refreshTaskIcon(taskState);

            if (taskState != NpcTaskState.NONE)
            {
                npc.listTaskId = dicNpcTaskState[npc.id].Keys.ToList <int>();
            }
            else
            {
                npc.listTaskId = null;
            }

            //   npc.OnRefreshTitle();
        }
示例#11
0
        public static void showDialog(object[] objs, Action forceDo)
        {
            NpcRole npc = null;

            GameObject go = GameObject.Find(objs[1].ToString());

            if (go == null)
            {
                return;
            }

            npc = go.GetComponent <NpcRole>();

            if (npc == null)
            {
                return;
            }

            dialog.showTalk(new List <string> {
                objs[2].ToString()
            }, null, npc, true);
        }
示例#12
0
        public void doNext()
        {
            bool flag = dialog.fake_npc != null;

            if (flag)
            {
                dialog.fake_npc = null;
                InterfaceMgr.getInstance().close(InterfaceMgr.DIALOG);
            }
            else
            {
                this.closeSubWins();
                bool flag2 = this.curIdx + 1 >= dialog.m_desc.Count;
                if (flag2)
                {
                    dialog.isLastDesc = true;
                }
                else
                {
                    dialog.isLastDesc = false;
                }
                bool flag3 = this.curIdx >= dialog.m_desc.Count;
                if (flag3)
                {
                    bool flag4 = dialog.m_handle != null;
                    if (flag4)
                    {
                        dialog.m_handle();
                    }
                    InterfaceMgr.getInstance().close(InterfaceMgr.DIALOG);
                }
                else
                {
                    this.showDesc(dialog.m_desc[this.curIdx]);
                    this.curIdx++;
                }
            }
        }
示例#13
0
        virtual public void onTriggerHanlde()
        {
            //  MonsterMgr._inst.AddMonster(transform);

            if (type == 1)
            {
                if (paramInts.Count == 0)
                {
                    return;
                }


                MonsterMgr._inst.AddMonster(paramInts[0], transform.position, 0, transform.localEulerAngles.y);
            }
            else if (type == 2)//enable
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                foreach (GameObject go in paramGo)
                {
                    go.SetActive(true);
                }
            }
            else if (type == 3)//unenable
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                foreach (GameObject go in paramGo)
                {
                    HiddenItem hideitem = go.GetComponent <HiddenItem>();
                    if (hideitem != null)
                    {
                        hideitem.hide();
                    }
                    else
                    {
                        go.SetActive(false);
                    }
                }
            }
            else if (type == 4)//nav
            {
                if (paramInts.Count == 0)
                {
                    return;
                }

                int idx = 0;
                for (int i = 0; i < paramInts.Count; i++)
                {
                    idx += NavmeshUtils.listARE[paramInts[i]];
                }

                if (idx == 0)
                {
                    return;
                }

                SelfRole._inst.setNavLay(idx);
            }
            else if (type == 5)
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                Transform con = paramGo[0].transform;
                for (int i = 0; i < con.childCount; i++)
                {
                    GameObject tempgi = con.GetChild(i).gameObject;
                    tempgi.AddComponent <BrokenIten>();
                }
            }
            else if (type == 6)
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                if (paramFloat.Count == 0)
                {
                    return;
                }

                if (paramBool)
                {
                    InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_HIDE_ALL);
                    a1_gamejoy.inst_joystick.stopDrag();
                }

                paramGo[1].SetActive(true);
                SceneCamera.changeAniCamera(paramGo[0], paramFloat[0]);
            }

            else if (type == 8)
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                paramGo[0].SetActive(true);

                HiddenItem hideitem = paramGo[0].GetComponent <HiddenItem>();
                if (hideitem != null)
                {
                    hideitem.hide();
                }
                else
                {
                    paramGo[0].SetActive(false);
                }
            }
            else if (type == 9)
            {
                if (paramFloat.Count < 2)
                {
                    return;
                }
                if (paramInts.Count < 1)
                {
                    return;
                }

                SceneCamera.cameraShake(paramFloat[0], paramInts[0], paramFloat[1]);
            }
            else if (type == 10)//eff
            {
                if (paramFloat.Count < 1)
                {
                    return;
                }
                if (paramGo.Count < 1)
                {
                    return;
                }
                GameObject tempGo = GameObject.Instantiate(paramGo[0]) as GameObject;

                tempGo.transform.SetParent(SelfRole._inst.m_curModel, false);
                Destroy(tempGo, paramFloat[0]);
            }
            else if (type == 11)//dialog
            {
                if (dialogid <= 0)
                {
                    return;
                }
                SXML          ncpxml = XMLMgr.instance.GetSXML("dialog");
                SXML          xml    = ncpxml.GetNode("dialog", "id==" + dialogid);
                List <string> lstr   = new List <string>();
                if (xml != null)
                {
                    List <SXML> l = new List <SXML>();
                    l = xml.GetNodeList("log");
                    foreach (SXML s in l)
                    {
                        lstr.Add(s.getString("value"));
                    }
                }
                List <string> ldialog = lstr;

                NpcRole npc = null;
                if (paramGo != null && paramGo.Count > 0 && paramGo[0] != null)
                {
                    npc = paramGo[0].GetComponent <NpcRole>();
                }

                DoAfterMgr.instacne.addAfterRender(() =>
                {
                    dialog.showTalk(ldialog, null, npc);
                });
            }
            else if (type == 12)//act
            {
                if (paramStr.Count < 1)
                {
                    return;
                }

                if (paramGo == null || paramGo.Count == 0 || paramGo[0] == null)
                {
                    SelfRole._inst.m_curAni.SetTrigger(paramStr[0]);
                }
                else
                {
                    Animator anim = paramGo[0].GetComponent <Animator>();
                    if (anim != null)
                    {
                        anim.SetTrigger(paramStr[0]);
                    }
                }
            }
            else if (type == 13)//newbiecode
            {
                if (waitCodesid == 0)
                {
                    return;
                }


                NewbieTeachMgr.getInstance().add(1, waitCodesid, -1);
            }
            else if (type == 14)//floatui
            {
                if (!paramBool)
                {
                    //InterfaceMgr.getInstance().floatUI.transform.localScale = Vector3.zero;
                    InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_STORY);
                    if (a1_gamejoy.inst_joystick != null)
                    {
                        a1_gamejoy.inst_joystick.OnDragOut();
                    }
                }
                else
                {
                    InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_NORMAL);
                    //InterfaceMgr.getInstance().floatUI.transform.localScale = Vector3.one;
                }
            }
            else if (type == 15)//gos
            {
                lGo = paramGo;
            }
            else if (type == 16)//group
            {
                if (paramGo.Count == 0)
                {
                    return;
                }

                foreach (GameObject go in paramGo)
                {
                    TriggerHanldePoint tri = go.GetComponent <TriggerHanldePoint>();
                    if (tri != null)
                    {
                        tri.onTriggerHanlde();
                    }
                }
            }
            else if (type == 17)
            {
                //延迟0.5秒关闭loading界面。解决avatar一闪和一些初始化的东西卡住的问题
                if (maploading.instance != null)
                {
                    maploading.instance.closeLoadWait(0.5f);
                }
            }
        }
示例#14
0
        private void OnNpcTaskStateChange(GameEvent e)
        {
            Variant data = e.data;
            int     num  = data["npcId"];
            int     num2 = data["taskId"];
            int     num3 = data["taskState"];
            bool    flag = !this.dicNpcTaskState.ContainsKey(num);

            if (flag)
            {
                Dictionary <int, int> dictionary = new Dictionary <int, int>();
                dictionary[num2]          = num3;
                this.dicNpcTaskState[num] = dictionary;
            }
            else
            {
                bool flag2 = num3 == 0;
                if (flag2)
                {
                    this.dicNpcTaskState[num].Remove(num2);
                }
                else
                {
                    this.dicNpcTaskState[num][num2] = num3;
                }
            }
            NpcRole    role      = this.getRole(num);
            List <int> list      = this.dicNpcTaskState[num].Values.ToList <int>();
            int        taskState = 0;
            bool       flag3     = list.Count > 0;

            if (flag3)
            {
                taskState = list.Max <int>();
            }
            this.SetNpcTaskState(role, (NpcTaskState)taskState);
            TaskData taskDataById = ModelBase <A3_TaskModel> .getInstance().GetTaskDataById(num2);

            bool flag4 = taskDataById != null;

            if (flag4)
            {
                bool topShowOnLiteminimap = taskDataById.topShowOnLiteminimap;
                if (topShowOnLiteminimap)
                {
                    a3_liteMinimap expr_11C = a3_liteMinimap.instance;
                    if (expr_11C != null)
                    {
                        expr_11C.SetTopShow(num2);
                    }
                }
                else
                {
                    a3_liteMinimap expr_130 = a3_liteMinimap.instance;
                    if (expr_130 != null)
                    {
                        expr_130.RefreshTaskPage(num2);
                    }
                }
            }
        }
示例#15
0
        public void initAvatar()
        {
            bool flag = this.m_anim_usr == null;

            if (flag)
            {
                this.m_selfObj = null;
                bool flag2 = SelfRole._inst is P2Warrior;
                if (flag2)
                {
                    GameObject original = Resources.Load <GameObject>("profession/avatar_ui/warrior_avatar");
                    this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject);
                    this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f));
                }
                else
                {
                    bool flag3 = SelfRole._inst is P3Mage;
                    if (flag3)
                    {
                        GameObject original = Resources.Load <GameObject>("profession/avatar_ui/mage_avatar");
                        this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject);
                        this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f));
                    }
                    else
                    {
                        bool flag4 = SelfRole._inst is P5Assassin;
                        if (flag4)
                        {
                            GameObject original = Resources.Load <GameObject>("profession/avatar_ui/assa_avatar");
                            this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject);
                            this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f));
                        }
                    }
                }
                Transform transform = this.m_selfObj.transform.FindChild("model");
                transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
                ProfessionAvatar professionAvatar = new ProfessionAvatar();
                professionAvatar.Init(SelfRole._inst.m_strAvatarPath, "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, transform, "");
                this.m_proAvatar = professionAvatar;
                bool flag5 = ModelBase <a3_EquipModel> .getInstance().active_eqp.Count >= 10;

                if (flag5)
                {
                    this.m_proAvatar.set_equip_eff(ModelBase <a3_EquipModel> .getInstance().GetEqpIdbyType(3), true);
                }
                professionAvatar.set_body(SelfRole._inst.get_bodyid(), SelfRole._inst.get_bodyfxid());
                professionAvatar.set_weaponl(SelfRole._inst.get_weaponl_id(), SelfRole._inst.get_weaponl_fxid());
                professionAvatar.set_weaponr(SelfRole._inst.get_weaponr_id(), SelfRole._inst.get_weaponr_fxid());
                professionAvatar.set_wing(SelfRole._inst.get_wingid(), SelfRole._inst.get_windfxid());
                professionAvatar.set_equip_color(SelfRole._inst.get_equip_colorid());
                this.m_anim_usr = transform.GetComponent <Animator>();
                Transform[] componentsInChildren = this.m_selfObj.GetComponentsInChildren <Transform>();
                Transform[] array = componentsInChildren;
                for (int i = 0; i < array.Length; i++)
                {
                    Transform transform2 = array[i];
                    transform2.gameObject.layer = EnumLayer.LM_DEFAULT;
                }
                bool flag6 = SelfRole._inst is P3Mage;
                if (flag6)
                {
                    Vector3 center = professionAvatar.m_BodySkin.localBounds.center;
                    center.y = 1.3f;
                    Bounds              localBounds = professionAvatar.m_BodySkin.localBounds;
                    Vector3             size        = localBounds.size;
                    SkinnedMeshRenderer arg_3BE_0   = professionAvatar.m_ShoulderSkin;
                    SkinnedMeshRenderer arg_3B6_0   = professionAvatar.m_BodySkin;
                    localBounds           = new Bounds(center, size);
                    arg_3B6_0.localBounds = localBounds;
                    arg_3BE_0.localBounds = localBounds;
                }
            }
            NpcRole npc   = dialog.m_npc;
            bool    flag7 = dialog.fake_npc != null;

            if (flag7)
            {
                npc = dialog.fake_npc;
            }
            bool flag8 = this.m_anim_npc == null && npc != null;

            if (flag8)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(npc.gameObject);
                this.m_anim_npc = gameObject.GetComponent <Animator>();
                UnityEngine.Object.Destroy(gameObject.GetComponent <NavMeshAgent>());
                gameObject.transform.localPosition = npc.talkOffset;
                gameObject.transform.localScale    = npc.talkScale;
                gameObject.transform.eulerAngles   = Vector3.zero;
                debug.Log(string.Concat(new object[]
                {
                    ":::::::::::::::::::::::::::::::::::::::::::::",
                    gameObject.transform.position,
                    " ",
                    gameObject.gameObject.name
                }));
                Transform[] componentsInChildren2 = gameObject.GetComponentsInChildren <Transform>();
                Transform[] array2 = componentsInChildren2;
                for (int j = 0; j < array2.Length; j++)
                {
                    Transform transform3 = array2[j];
                    transform3.gameObject.layer = EnumLayer.LM_DEFAULT;
                }
                NpcRole component = gameObject.GetComponent <NpcRole>();
                bool    flag9     = component != null;
                if (flag9)
                {
                    UnityEngine.Object.Destroy(component);
                }
            }
        }
示例#16
0
        private void OnShowOptionUi()
        {
            this.conIcon.gameObject.SetActive(false);
            this.conOption.parent.gameObject.SetActive(true);
            this.bg_task.gameObject.SetActive(false);
            NpcRole    npc        = dialog.m_npc;
            List <int> listTaskId = npc.listTaskId;
            bool       flag       = listTaskId != null;

            if (flag)
            {
                for (int i = 0; i < listTaskId.Count; i++)
                {
                    int        taskId     = listTaskId[i];
                    string     taskName   = this.tkModel.GetTaskDataById(taskId).taskName;
                    bool       flag2      = this.tkModel.GetTaskDataById(taskId).taskT == TaskType.MAIN;
                    GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.optionTemp);
                    switch (this.tkModel.GetTaskDataById(taskId).taskT)
                    {
                    case TaskType.MAIN:
                        gameObject.transform.FindChild("sign/main").gameObject.SetActive(true);
                        break;

                    case TaskType.BRANCH:
                        gameObject.transform.FindChild("sign/branch").gameObject.SetActive(true);
                        break;

                    case TaskType.ENTRUST:
                        gameObject.transform.FindChild("sign/entrust").gameObject.SetActive(true);
                        break;

                    case TaskType.CLAN:
                        gameObject.transform.FindChild("sign/clan").gameObject.SetActive(true);
                        break;
                    }
                    gameObject.transform.FindChild("Text").GetComponent <Text>().text = taskName;
                    gameObject.transform.SetParent(this.conOption, false);
                    gameObject.SetActive(true);
                    BaseButton baseButton = new BaseButton(gameObject.transform, 1, 1);
                    baseButton.onClick         = new Action <GameObject>(this.OnOptionBtnClick);
                    baseButton.gameObject.name = taskId.ToString();
                }
            }
            bool flag3 = npc.openid != "";

            if (flag3)
            {
                GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.optionTemp);
                gameObject2.transform.FindChild("sign/func").gameObject.SetActive(true);
                bool flag4 = npc.openid == "a3_warehouse";
                if (flag4)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "仓库";
                }
                bool flag5 = npc.openid == "A3_FindBesto";
                if (flag5)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "藏宝图兑换";
                }
                bool flag6 = npc.openid == "a3_resetlvl";
                if (flag6)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "转生";
                }
                bool flag7 = npc.openid == "A3_Smithy";
                if (flag7)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "铁匠铺";
                }
                bool flag8 = npc.openid == "a3_npc_shop";
                if (flag8)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "NPC商店";
                    this.npc_id = npc.id;
                }
                bool flag9 = npc.openid == "a3_legion_dart";
                if (flag9)
                {
                    gameObject2.transform.FindChild("Text").GetComponent <Text>().text = "军团运镖";
                }
                gameObject2.transform.SetParent(this.conOption, false);
                gameObject2.SetActive(true);
                BaseButton baseButton2 = new BaseButton(gameObject2.transform, 1, 1);
                baseButton2.onClick         = new Action <GameObject>(this.OnOptionBtnClick);
                baseButton2.gameObject.name = npc.openid;
            }
        }
示例#17
0
        public void initAvatar()
        {
            //GameObject goSkmesh_camera;
            //m_skmesh_camera.transform.localPosition = new Vector3(-129.7f, 1.34f, -124.98f);

            if (m_anim_usr == null)
            {
                //加入主角的显示
                //Variant data = muNetCleint.instance.joinWorldInfoInst.mainPlayerInfo;
                //string model_id = data["sex"]._str;

                m_selfObj = null;
                GameObject    obj_prefab;
                A3_PROFESSION eprofession = A3_PROFESSION.None;
                if (SelfRole._inst is P2Warrior)
                {
                    eprofession = A3_PROFESSION.Warrior;
                    obj_prefab  = GAMEAPI.ABFight_LoadPrefab("model_avatar_ui_warrior_avatar");
                    m_selfObj   = GameObject.Instantiate(obj_prefab, new Vector3(500, 0f, 1f), new Quaternion(0, 0, 0, 0)) as GameObject;

                    m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0, -20, 0));
                }
                else if (SelfRole._inst is P3Mage)
                {
                    eprofession = A3_PROFESSION.Mage;
                    obj_prefab  = GAMEAPI.ABFight_LoadPrefab("model_avatar_ui_mage_avatar");
                    m_selfObj   = GameObject.Instantiate(obj_prefab, new Vector3(500, 0f, 1f), new Quaternion(0, 0, 0, 0)) as GameObject;
                    m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0, -20, 0));
                }
                else if (SelfRole._inst is P5Assassin)
                {
                    eprofession = A3_PROFESSION.Assassin;
                    obj_prefab  = GAMEAPI.ABFight_LoadPrefab("model_avatar_ui_assa_avatar");
                    m_selfObj   = GameObject.Instantiate(obj_prefab, new Vector3(500, 0f, 1f), new Quaternion(0, 0, 0, 0)) as GameObject;
                    m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0, -20, 0));
                }

                Transform trans = m_selfObj.transform.FindChild("model");

                trans.localScale = new Vector3(1.3f, 1.3f, 1.3f);

                m_proAvatar = new ProfessionAvatar();

                m_proAvatar.Init_PA(eprofession, SelfRole._inst.m_strAvatarPath, "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, trans);

                if (a3_EquipModel.getInstance().active_eqp.Count >= 10)
                {
                    m_proAvatar.set_equip_eff(a3_EquipModel.getInstance().GetEqpIdbyType(3), true);
                }
                m_proAvatar.set_equip_eff(a3_EquipModel.getInstance().GetEff_lvl(a3_EquipModel.getInstance().active_eqp.Count));
                m_proAvatar.set_body(SelfRole._inst.get_bodyid(), SelfRole._inst.get_bodyfxid());
                m_proAvatar.set_weaponl(SelfRole._inst.get_weaponl_id(), SelfRole._inst.get_weaponl_fxid());
                m_proAvatar.set_weaponr(SelfRole._inst.get_weaponr_id(), SelfRole._inst.get_weaponr_fxid());
                m_proAvatar.set_wing(SelfRole._inst.get_wingid(), SelfRole._inst.get_windfxid());
                m_proAvatar.set_equip_color(SelfRole._inst.get_equip_colorid());
                m_anim_usr = trans.GetComponent <Animator>();

                //m_selfObj.transform.eulerAngles = Vector3.zero;


                Transform[] listT = m_selfObj.GetComponentsInChildren <Transform>();
                foreach (Transform tran in listT)
                {
                    tran.gameObject.layer = EnumLayer.LM_DEFAULT;
                }

                if (SelfRole._inst is P3Mage)
                {
                    Vector3 centervec = m_proAvatar.m_BodySkin.localBounds.center;
                    centervec.y = 1.3f;
                    Vector3 sizevec = m_proAvatar.m_BodySkin.localBounds.size;
                    m_proAvatar.m_ShoulderSkin.localBounds = m_proAvatar.m_BodySkin.localBounds = new Bounds(centervec, sizevec);

                    // usr.m_BodySkin.bounds
                }


                //GameObject skmesh_usr = GameObject.Instantiate(SelfRole._inst.m_curModel.gameObject) as GameObject;
                //m_anim_usr = skmesh_usr.GetComponent<Animator>();
                //Destroy(skmesh_usr.GetComponent<NavMeshAgent>());
                //skmesh_usr.transform.position = new Vector3(65535f, 1f, 1f);
                //skmesh_usr.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f);
                //skmesh_usr.transform.eulerAngles = Vector3.zero;
            }


            NpcRole npc = m_npc;

            if (fake_npc != null)
            {
                npc = fake_npc;
            }

            if (m_npc_obj == null && npc != null)
            {
                GameObject skmesh_npc        = GameObject.Instantiate(npc.gameObject) as GameObject;
                bool       build_npc_success = true;
                if (skmesh_npc.transform.childCount > 0)
                {
                    Transform tf_model = skmesh_npc.transform.GetChild(0).FindChild("model");
                    if (tf_model != null)
                    {
                        tf_model.localPosition = Vector3.zero;
                        m_anim_npc             = tf_model.GetComponent <Animator>();
                        m_npc_obj = skmesh_npc;
                        Destroy(skmesh_npc.GetComponent <NavMeshAgent>());
                        skmesh_npc.transform.localPosition = npc.talkOffset;
                        skmesh_npc.transform.localScale    = npc.talkScale;
                        skmesh_npc.transform.eulerAngles   = Vector3.zero;


                        debug.Log(":::::::::::::::::::::::::::::::::::::::::::::" + skmesh_npc.transform.position + " " + skmesh_npc.gameObject.name);

                        Transform[] listTN = skmesh_npc.GetComponentsInChildren <Transform>();
                        foreach (Transform tran in listTN)
                        {
                            tran.gameObject.layer = EnumLayer.LM_DEFAULT;
                        }

                        NpcRole npcrole = skmesh_npc.GetComponent <NpcRole>();
                        if (npcrole != null)
                        {
                            Destroy(npcrole);
                        }
                    }
                    else
                    {
                        build_npc_success = false;
                    }
                }
                else
                {
                    build_npc_success = false;
                }

                if (build_npc_success == false)
                {
                    Debug.LogError("创建NPC失败: " + skmesh_npc.name);
                    GameObject.Destroy(skmesh_npc);
                }
            }
        }
示例#18
0
        //显示功能界面
        private void OnShowOptionUi()
        {
            conIcon.gameObject.SetActive(false);
            conOption.parent.gameObject.SetActive(true);
            bg_task.gameObject.SetActive(false);

            NpcRole    npc     = dialog.m_npc;
            List <int> listtid = npc.listTaskId;

            if (listtid != null)
            {
                for (int i = 0; i < listtid.Count; i++)
                {
                    int        id      = listtid[i];
                    string     name    = tkModel.GetTaskDataById(id).taskName;
                    bool       isMain  = tkModel.GetTaskDataById(id).taskT == TaskType.MAIN;
                    GameObject btnClon = Instantiate(optionTemp) as GameObject;
                    //if (isMain)
                    //else
                    switch (tkModel.GetTaskDataById(id).taskT)
                    {
                    case TaskType.MAIN: btnClon.transform.FindChild("sign/main").gameObject.SetActive(true); break;

                    case TaskType.BRANCH: btnClon.transform.FindChild("sign/branch").gameObject.SetActive(true); break;

                    case TaskType.CLAN: btnClon.transform.FindChild("sign/clan").gameObject.SetActive(true); break;

                    case TaskType.ENTRUST: btnClon.transform.FindChild("sign/entrust").gameObject.SetActive(true); break;
                    }
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = name;

                    btnClon.transform.SetParent(conOption, false);
                    btnClon.SetActive(true);

                    BaseButton btn = new BaseButton(btnClon.transform);
                    btn.onClick         = OnOptionBtnClick;
                    btn.gameObject.name = id.ToString();
                }
            }

            if (npc.openid != "")
            {
                GameObject btnClon = Instantiate(optionTemp) as GameObject;
                btnClon.transform.FindChild("sign/func").gameObject.SetActive(true);

                if (npc.openid == "a3_warehouse")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk5");
                }

                if (npc.openid == "A3_FindBesto")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk6");
                }

                if (npc.openid == "a3_resetlvl")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk0");
                }

                if (npc.openid == "A3_Smithy")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk7");
                }
                if (npc.openid == "a3_npc_shop")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk8");
                    npc_id = npc.id;
                }
                if (npc.openid == "a3_legion_dart")
                {
                    btnClon.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("npctasktalk9");
                }

                btnClon.transform.SetParent(conOption, false);
                btnClon.SetActive(true);
                BaseButton btn = new BaseButton(btnClon.transform);
                btn.onClick         = OnOptionBtnClick;
                btn.gameObject.name = npc.openid;
            }
        }
示例#19
0
        public virtual void onTriggerHanlde()
        {
            bool flag = this.type == 1;

            if (flag)
            {
                bool flag2 = this.paramInts.Count == 0;
                if (!flag2)
                {
                    MonsterMgr._inst.AddMonster(this.paramInts[0], base.transform.position, 0u, base.transform.localEulerAngles.y, 0, 0, null);
                }
            }
            else
            {
                bool flag3 = this.type == 2;
                if (flag3)
                {
                    bool flag4 = this.paramGo.Count == 0;
                    if (!flag4)
                    {
                        foreach (GameObject current in this.paramGo)
                        {
                            current.SetActive(true);
                        }
                    }
                }
                else
                {
                    bool flag5 = this.type == 3;
                    if (flag5)
                    {
                        bool flag6 = this.paramGo.Count == 0;
                        if (!flag6)
                        {
                            foreach (GameObject current2 in this.paramGo)
                            {
                                HiddenItem component = current2.GetComponent <HiddenItem>();
                                bool       flag7     = component != null;
                                if (flag7)
                                {
                                    component.hide();
                                }
                                else
                                {
                                    current2.SetActive(false);
                                }
                            }
                        }
                    }
                    else
                    {
                        bool flag8 = this.type == 4;
                        if (flag8)
                        {
                            bool flag9 = this.paramInts.Count == 0;
                            if (!flag9)
                            {
                                int num = 0;
                                for (int i = 0; i < this.paramInts.Count; i++)
                                {
                                    num += NavmeshUtils.listARE[this.paramInts[i]];
                                }
                                bool flag10 = num == 0;
                                if (!flag10)
                                {
                                    SelfRole._inst.setNavLay(num);
                                }
                            }
                        }
                        else
                        {
                            bool flag11 = this.type == 5;
                            if (flag11)
                            {
                                bool flag12 = this.paramGo.Count == 0;
                                if (!flag12)
                                {
                                    Transform transform = this.paramGo[0].transform;
                                    for (int j = 0; j < transform.childCount; j++)
                                    {
                                        GameObject gameObject = transform.GetChild(j).gameObject;
                                        gameObject.AddComponent <BrokenIten>();
                                    }
                                }
                            }
                            else
                            {
                                bool flag13 = this.type == 6;
                                if (flag13)
                                {
                                    bool flag14 = this.paramGo.Count == 0;
                                    if (!flag14)
                                    {
                                        bool flag15 = this.paramFloat.Count == 0;
                                        if (!flag15)
                                        {
                                            bool flag16 = this.paramBool;
                                            if (flag16)
                                            {
                                                InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_HIDE_ALL);
                                                joystick.instance.stopDrag();
                                            }
                                            this.paramGo[1].SetActive(true);
                                            SceneCamera.changeAniCamera(this.paramGo[0], this.paramFloat[0]);
                                        }
                                    }
                                }
                                else
                                {
                                    bool flag17 = this.type == 8;
                                    if (flag17)
                                    {
                                        bool flag18 = this.paramGo.Count == 0;
                                        if (!flag18)
                                        {
                                            this.paramGo[0].SetActive(true);
                                            HiddenItem component2 = this.paramGo[0].GetComponent <HiddenItem>();
                                            bool       flag19     = component2 != null;
                                            if (flag19)
                                            {
                                                component2.hide();
                                            }
                                            else
                                            {
                                                this.paramGo[0].SetActive(false);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        bool flag20 = this.type == 9;
                                        if (flag20)
                                        {
                                            bool flag21 = this.paramFloat.Count < 2;
                                            if (!flag21)
                                            {
                                                bool flag22 = this.paramInts.Count < 1;
                                                if (!flag22)
                                                {
                                                    SceneCamera.cameraShake(this.paramFloat[0], this.paramInts[0], this.paramFloat[1]);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            bool flag23 = this.type == 10;
                                            if (flag23)
                                            {
                                                bool flag24 = this.paramFloat.Count < 1;
                                                if (!flag24)
                                                {
                                                    bool flag25 = this.paramGo.Count < 1;
                                                    if (!flag25)
                                                    {
                                                        GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.paramGo[0]);
                                                        gameObject2.transform.SetParent(SelfRole._inst.m_curModel, false);
                                                        UnityEngine.Object.Destroy(gameObject2, this.paramFloat[0]);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                bool flag26 = this.type == 11;
                                                if (flag26)
                                                {
                                                    bool flag27 = this.paramStr.Count < 1;
                                                    if (!flag27)
                                                    {
                                                        List <string> ldialog = this.paramStr;
                                                        NpcRole       npc     = null;
                                                        bool          flag28  = this.paramGo != null && this.paramGo.Count > 0 && this.paramGo[0] != null;
                                                        if (flag28)
                                                        {
                                                            npc = this.paramGo[0].GetComponent <NpcRole>();
                                                        }
                                                        DoAfterMgr.instacne.addAfterRender(delegate
                                                        {
                                                            dialog.showTalk(ldialog, null, npc, false);
                                                        });
                                                    }
                                                }
                                                else
                                                {
                                                    bool flag29 = this.type == 12;
                                                    if (flag29)
                                                    {
                                                        bool flag30 = this.paramStr.Count < 1;
                                                        if (!flag30)
                                                        {
                                                            bool flag31 = this.paramGo == null || this.paramGo.Count == 0 || this.paramGo[0] == null;
                                                            if (flag31)
                                                            {
                                                                SelfRole._inst.m_curAni.SetTrigger(this.paramStr[0]);
                                                            }
                                                            else
                                                            {
                                                                Animator component3 = this.paramGo[0].GetComponent <Animator>();
                                                                bool     flag32     = component3 != null;
                                                                if (flag32)
                                                                {
                                                                    component3.SetTrigger(this.paramStr[0]);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        bool flag33 = this.type == 13;
                                                        if (flag33)
                                                        {
                                                            bool flag34 = this.paramStr.Count < 1;
                                                            if (!flag34)
                                                            {
                                                                NewbieTeachMgr.getInstance().add(this.paramStr, -1);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            bool flag35 = this.type == 14;
                                                            if (flag35)
                                                            {
                                                                bool flag36 = !this.paramBool;
                                                                if (flag36)
                                                                {
                                                                    InterfaceMgr.getInstance().floatUI.transform.localScale = Vector3.zero;
                                                                    bool flag37 = joystick.instance != null;
                                                                    if (flag37)
                                                                    {
                                                                        joystick.instance.OnDragOut(null);
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    InterfaceMgr.getInstance().floatUI.transform.localScale = Vector3.one;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                bool flag38 = this.type == 15;
                                                                if (flag38)
                                                                {
                                                                    TriggerHanldePoint.lGo = this.paramGo;
                                                                }
                                                                else
                                                                {
                                                                    bool flag39 = this.type == 16;
                                                                    if (flag39)
                                                                    {
                                                                        bool flag40 = this.paramGo.Count == 0;
                                                                        if (!flag40)
                                                                        {
                                                                            foreach (GameObject current3 in this.paramGo)
                                                                            {
                                                                                TriggerHanldePoint component4 = current3.GetComponent <TriggerHanldePoint>();
                                                                                bool flag41 = component4 != null;
                                                                                if (flag41)
                                                                                {
                                                                                    component4.onTriggerHanlde();
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        bool flag42 = this.type == 17;
                                                                        if (flag42)
                                                                        {
                                                                            bool flag43 = maploading.instance != null;
                                                                            if (flag43)
                                                                            {
                                                                                maploading.instance.closeLoadWait(0.5f);
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }