Exemple #1
0
        /// <summary>
        /// 返回上级设备组
        /// </summary>
        public void backSuperNode()
        {
            MyTreeMenuItem item = treeMenu.getItem(this.currentModel);

            if (item == null)
            {
                return;
            }

            if (item.getParent() != null)
            {
                //backSuperNodeBtn.gameObject.SetActive(true);
                leafNodesClick(item.getParent().getItemVO().value, true);
                treeMenu.Locate(item.getParent().getItemVO().value, true, false);
            }
            else
            {
                backSuperNodeBtn.gameObject.SetActive(false);
                mouseFocus.ChangeCamera(false);
                treeMenu.allFold();
                this.isWalkCamea  = true;
                this.currentGroup = null;
                this.currentModel = null;
            }
        }
Exemple #2
0
        /// <summary>
        /// 该节点是否在当前组中
        /// </summary>
        /// <param name="group"></param>
        /// <param name="equip"></param>
        /// <param name="isClick"></param>
        /// <returns></returns>
        public bool myFindEquipGroup(EquipKnow group, EquipKnow equip, bool isClick = false)
        {
            bool flag = false;

            foreach (EquipKnow eq in group.EquipKnows)
            {
                if (eq.EquipKnows.Count != 0)
                {
                    if (eq.Model.Equals(equip.Model))
                    {
                        flag = true;
                    }
                    else
                    {
                        flag = myFindEquipGroup(eq, equip);
                    }
                }
                else
                {
                    if (eq.Model.Equals(equip.Model))
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    break;
                }
            }
            return(flag);
        }
Exemple #3
0
 //void OnGUI()
 //{
 //    if (GUILayout.Button("树形菜单初始化"))
 //    {
 //        initTreeMenu();s
 //    }
 //}
 public void oncheck()
 {
     mouseFocus.ChangeCamera(false);
     backSuperNodeBtn.gameObject.SetActive(false);
     this.isWalkCamea  = true;
     this.currentGroup = null;
     this.currentModel = null;
 }
Exemple #4
0
 private void clear()
 {
     isShowTreeMenu  = true;
     isWalkCamea     = true;
     alertMSG        = null;
     currentEquipTip = null;
     currentModel    = null;
     currentGroup    = null;
 }
Exemple #5
0
 public void HighLightObj(EquipKnow equip, List <string> equips)
 {
     if (equip.ModelObject == null)
     {
         equip.ModelObject = GameObject.Find(equip.Model);
     }
     if (equip.ModelObject != null)
     {
         getAllChildTransform(equip.ModelObject.transform, equips);
     }
 }
Exemple #6
0
        public void clickSceneEvent(GameObject obj)
        {
            EquipKnow group = new EquipKnow();

            if (myGetGroud(obj, out group, true).Count == 0)
            {
                return;
            }

            treeMenu.Locate(group.Model, false);
            mouseoverSceneEvent(group.ModelObject);
        }
Exemple #7
0
        /// <summary>
        /// 树形菜单节点被点击事件委托(包括父节点被点击)
        /// </summary>
        /// <param name="name"></param>
        public void leafNodesClick(string value, bool isMenu)
        {
            EquipKnow equipKnow = InitConfigs.Instance.EquipKnowDic[value];

            if (equipKnow.audio != null)
            {
                AudioManager.getInstance().AudioStop(AudioManager.MusicNumType.realtimeMusic);
                AudioManager.getInstance().AudioPlay("sbrz/" + equipKnow.audio, AudioManager.MusicNumType.realtimeMusic);
            }
            DestroyUI(null);
            uiTool.setActiveControlPanel(true);
            setSomeUiActive(false);
            AnimationContorll(false);
            uiTool.setShiwaiSliderValue(Convert.ToSingle(getNumberByLevel(1, value)) / count, Convert.ToInt32(getNumberByLevel(1, value)), count);
            this.currentModel = value;
            print(getItemLevel(value));
            string str = equipKnow.Detail;

            if (getItemLevel(value) != 4)
            {
                BackOriginal();
            }
            CallTextInfo(str);
            JudgeName(equipKnow.Name);
            if (getItemLevel(value) == 1)
            {
                treeMenu.resetCurrentFlow();
                treeMenu.setCurrentFlow();
            }
            if (equipKnow.Name.Equals("漫游认知"))
            {
                return;
            }

            //AudioManager.getInstance().AudioStop(AudioManager.MusicNumType.realtimeMusic);//先停止 后面再播放


            setScene(equipKnow.Model, isMenu);
            showAlertMSG(equipKnow.Warm);

            if (getItemLevel(value) >= 2)
            {
                istext = true;
                showEquipTip(equipKnow.Name, equipKnow.ModelObject);
            }
            else
            {
                istext = true;
                CloseText();
            }
        }
Exemple #8
0
 private void getAllChild(EquipKnow equip, List <EquipKnow> equips)
 {
     if (equip.EquipKnows != null && equip.EquipKnows.Count > 0)
     {
         foreach (EquipKnow item in equip.EquipKnows)
         {
             getAllChild(item, equips);
         }
     }
     else
     {
         equips.Add(equip);
     }
 }
Exemple #9
0
        public void mouseoverSceneEvent(GameObject obj)
        {
            //if (!equipKnowDic.ContainsKey(obj.name))
            //    return;
            EquipKnow        group  = new EquipKnow();
            List <EquipKnow> equips = myGetGroud(obj, out group);

            if (equips.Count == 0)
            {
                return;
            }
            if (equips != null)
            {
                group.ModelObject = GameObject.Find(group.Model);
                showEquipTip(group.Name, group.ModelObject);
                HighLightObj(group, MyMouseFocus.LightMode.light);
            }
        }
Exemple #10
0
        public void HighLightObj(EquipKnow equip, MyMouseFocus.LightMode light)
        {
            List <string> equips = new List <string>();

            HighLightObj(equip, equips);
            if (equips.Count != 0)
            {
                string names = equips[0];
                for (int i = 1; i < equips.Count; i++)
                {
                    names += "," + equips[i];
                }
                mouseFocus.HighLightObj(names, light);
            }
            else
            {
                return;
            }
        }
Exemple #11
0
        /// <summary>
        /// 从树形菜单聚焦物体,获取该节点下所有子节点
        /// </summary>
        /// <param name="equip"></param>
        /// <returns></returns>
        private List <EquipKnow> getMenuGroud(EquipKnow equip)
        {
            List <EquipKnow> equips = new List <EquipKnow>();

            if (equip.EquipKnows == null || equip.EquipKnows.Count == 0)
            {
                if (equip.ParentEquipKnow != null)
                {
                    this.currentGroup = equip.ParentEquipKnow;
                }
                getAllChild(equip, equips);
            }
            else
            {
                this.currentGroup = equip;
                getAllChild(equip, equips);
            }
            return(equips);
        }
Exemple #12
0
        public void ChildrenBtnClick(GameObject obj)
        {
            EquipKnow ChildrenBtn = InitConfigs.Instance.ChildrenBtnDic[obj.name];

            if (ChildrenBtn.audio != null)
            {
                AudioManager.getInstance().AudioStop(AudioManager.MusicNumType.realtimeMusic);
                AudioManager.getInstance().AudioPlay("sbrz/" + ChildrenBtn.audio, AudioManager.MusicNumType.realtimeMusic);
            }
            BackOriginal();
            mouseFocus.ChangeTarget(ChildrenBtn.Model, ChildrenBtn.Offset.x, ChildrenBtn.Offset.y, ChildrenBtn.Offset.z);
            mouseFocus.setLimit(ChildrenBtn.LimitYaw, ChildrenBtn.LimitPitch, ChildrenBtn.LimitDistance);
            HighLightByButton(ChildrenBtn.Model);
            if (ChildrenBtn.transparent[0] != "")
            {
                foreach (string item in ChildrenBtn.transparent)
                {
                    ChangeShader("touming", item);
                }
            }
            ShowEquiPTipByButton(ChildrenBtn.showInfo, ChildrenBtn.Model);
            istext = true;
        }
Exemple #13
0
        private List <EquipKnow> readEquipKnowConfig(XmlNodeList nodes, XmlUtil xmlUtil, listType listType, EquipKnow equip = null)
        {
            List <EquipKnow> items = new List <EquipKnow>();

            try
            {
                foreach (XmlNode node in nodes)
                {
                    EquipKnow item = new EquipKnow();
                    item.ParentEquipKnow = equip;
                    item.Name            = xmlUtil.ReadAttrValue(node, "菜单名字");
                    item.Model           = xmlUtil.ReadAttrValue(node, "模型名");
                    item.Detail          = xmlUtil.ReadAttrValue(node, "详细信息");
                    item.Warm            = xmlUtil.ReadAttrValue(node, "警告信息");
                    string[] offs = xmlUtil.ReadAttrValue(node, "偏移").Split(',');
                    if (xmlUtil.ReadAttrValue(node, "解说语音") != null)
                    {
                        item.audio = xmlUtil.ReadAttrValue(node, "解说语音");
                    }

                    if (offs.Length == 3)
                    {
                        item.Offset = new Vector3(float.Parse(offs[0]), float.Parse(offs[1]), float.Parse(offs[2]));
                    }

                    if (xmlUtil.GetChildNodes(node).Count > 0)
                    {
                        item.EquipKnows.AddRange(readEquipKnowConfig(xmlUtil.GetChildNodes(node), xmlUtil, listType, item));
                    }

                    if (node.Attributes["范围"] != null)
                    {
                        string[] limit  = xmlUtil.ReadAttrValue(node, "范围").Split(',');
                        float    minyaw = float.Parse(limit[0]);
                        float    maxyaw = float.Parse(limit[1]);
                        item.LimitYaw = new Vector2(maxyaw > minyaw ? minyaw : maxyaw, maxyaw > minyaw ? maxyaw : minyaw);
                        float minpitch = float.Parse(limit[2]);
                        float maxpitch = float.Parse(limit[3]);
                        item.LimitPitch = new Vector2(maxpitch > minpitch ? minpitch : maxpitch, maxpitch > minpitch ? maxpitch : minpitch);
                        float minDistance = float.Parse(limit[4]);
                        float maxDistance = float.Parse(limit[5]);
                        item.LimitDistance = new Vector2(maxDistance > minDistance ? minDistance : maxDistance, maxDistance > minDistance ? maxDistance : minDistance);
                    }
                    items.Add(item);
                    if (listType == listType.treeMune)
                    {
                        if (equipKnowDic.ContainsKey(item.Model))
                        {
                            Debug.LogWarning("已存在");
                        }
                        else
                        {
                            equipKnowDic.Add(item.Model, item);
                        }
                    }
                    else
                    {
                        item.showInfo = xmlUtil.ReadAttrValue(node, "显示名称");
                        if (xmlUtil.ReadAttrValue(node, "隐藏模型").Split(',') != null)
                        {
                            string[] touming = xmlUtil.ReadAttrValue(node, "隐藏模型").Split(',');
                            if (touming != null)
                            {
                                for (int i = 0; i < touming.Length; i++)
                                {
                                    item.transparent.Add(touming[i]);
                                }
                            }
                        }
                        if (childrenBtnDic.ContainsKey(item.Model))
                        {
                            Debug.LogWarning("已存在");
                        }
                        else
                        {
                            childrenBtnDic.Add(item.Name, item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("读取xml文件错误" + e);
            }
            return(items);
        }
Exemple #14
0
 private EquipKnow getCurrentGroup(EquipKnow equip)
 {
     return(null);
 }
Exemple #15
0
        /// <summary>
        /// 获取该组所有子物体, 返回null:点击的物体不属于当前组
        /// 返回的集合中只有一个物体,点击的不是组,是物体,直接聚焦该物体
        /// </summary>
        /// <param name="equip"></param>
        /// <param name="equipGroup"></param>
        /// <param name="isClick"></param>
        /// <returns></returns>
        private List <EquipKnow> myGetGroud(GameObject equip, out EquipKnow equipGroup, bool isClick = false)
        {
            List <EquipKnow> equips      = new List <EquipKnow>();
            Transform        groupObject = equip.transform;

            equipGroup = null;

            if (currentGroup == null)
            {
                bool flag  = false;
                bool flag1 = false;
                if (InitConfigs.Instance.EquipKnowDic.ContainsKey(groupObject.name))
                {
                    flag1      = true;
                    equipGroup = InitConfigs.Instance.EquipKnowDic[groupObject.name];
                }
                while (true)
                {
                    if (groupObject.parent == null)
                    {
                        if (flag1)
                        {
                            flag = true;
                        }
                        break;
                    }
                    else if (!InitConfigs.Instance.EquipKnowDic.ContainsKey(groupObject.parent.name))
                    {
                        if (flag1)
                        {
                            flag       = true;
                            equipGroup = InitConfigs.Instance.EquipKnowDic[groupObject.name];
                            break;
                        }
                        else
                        {
                            groupObject = groupObject.parent;
                        }
                    }
                    else
                    {
                        flag1       = true;
                        groupObject = groupObject.parent;
                    }
                }
                if (!flag)
                {
                    return(equips);
                }
                if (isClick)
                {
                    this.currentGroup = equipGroup;
                    this.currentModel = equipGroup.Model;
                }
            }
            else
            {
                bool flag = false;
                if (InitConfigs.Instance.EquipKnowDic.ContainsKey(groupObject.name))
                {
                    flag       = true;
                    equipGroup = InitConfigs.Instance.EquipKnowDic[groupObject.name];
                }
                else
                {
                    while (true)
                    {
                        if (groupObject.parent == null)
                        {
                            break;
                        }
                        else if (!InitConfigs.Instance.EquipKnowDic.ContainsKey(groupObject.parent.name))
                        {
                            groupObject = groupObject.parent;
                        }
                        else
                        {
                            flag = true;
                            if (equipGroup == null)
                            {
                                equipGroup = InitConfigs.Instance.EquipKnowDic[groupObject.parent.name];
                            }
                            break;
                        }
                    }
                }
                if (!flag)
                {
                    return(equips);
                }

                if (!myFindEquipGroup(currentGroup, equipGroup, isClick))
                {
                    return(equips);
                }

                flag = false;
                while (true)
                {
                    if (equipGroup.ParentEquipKnow == currentGroup)
                    {
                        break;
                    }
                    flag       = true;
                    equipGroup = equipGroup.ParentEquipKnow;
                }

                if (isClick)
                {
                    if (flag)
                    {
                        this.currentGroup = equipGroup;
                        this.currentModel = equipGroup.Model;
                    }
                    else
                    {
                        this.currentModel = equipGroup.Model;
                    }
                }
            }
            getAllChild(equipGroup, equips);
            return(equips);
        }
Exemple #16
0
        public void setScene(string objName, bool isMenu = false)
        {
            if (!InitConfigs.Instance.EquipKnowDic.ContainsKey(objName))
            {
                return;
            }
            EquipKnow        equip  = InitConfigs.Instance.EquipKnowDic[objName];
            List <EquipKnow> equips = null;
            EquipKnow        group  = null;

            if (!isMenu)
            {
                //equips = getGroud(equip, out group, true);
                equip.ModelObject = GameObject.Find(objName);
                equips            = myGetGroud(equip.ModelObject, out group, true);
            }
            else
            {
                group  = equip;
                equips = getMenuGroud(equip);
            }
            if (equips != null)
            {
                if (this.isWalkCamea)
                {
                    this.isWalkCamea = false;
                    //backSuperNodeBtn.gameObject.SetActive(true);
                    mouseFocus.ChangeCamera(true);
                }
                if (equips.Count == 1)
                {
                    if (equips[0].Offset != null)
                    {
                        if (equips[0].LimitYaw != Vector2.zero)
                        {
                            mouseFocus.setLimit(equips[0].LimitYaw, equips[0].LimitPitch, equips[0].LimitDistance);
                        }
                        mouseFocus.ChangeTarget(equips[0].Model, equips[0].Offset.x, equips[0].Offset.y, equips[0].Offset.z);
                    }
                    else
                    {
                        mouseFocus.ChangeTarget(equips[0].Model);
                    }
                }
                else
                {
                    EquipKnow know = InitConfigs.Instance.EquipKnowDic[this.currentModel];
                    if (know.Offset != null)
                    {
                        if (know.LimitYaw != Vector2.zero)
                        {
                            mouseFocus.setLimit(know.LimitYaw, know.LimitPitch, know.LimitDistance);
                        }
                        mouseFocus.ChangeTarget(this.currentModel, know.Offset.x, know.Offset.y, know.Offset.z);
                    }
                    else
                    {
                        mouseFocus.ChangeTarget(this.currentModel);
                    }
                }
                HighLightObj(group, MyMouseFocus.LightMode.flash);
            }
        }