コード例 #1
0
ファイル: LevelEvent.cs プロジェクト: mengtest/demo_tankWar3D
        public override void Import(XmlObject pData, bool pBuild)
        {
            MapEvent data = pData as MapEvent;

            if (data == null)
            {
                return;
            }

            Type         = data.Type;
            TypeId       = data.Id;
            Relation1    = data.Relation1;
            Conditions1  = data.Conditions1;
            TriggerDelay = data.TriggerDelay;
            Active       = data.Active;
            if (data.Conditions2 != null)
            {
                Relation2       = data.Relation2;
                Conditions2     = data.Conditions2;
                TriggerNum      = data.TriggerNum;
                TriggerInterval = data.TriggerInterval;
            }

            Build();
            SetName();
        }
コード例 #2
0
ファイル: MapEvent.cs プロジェクト: mengtest/demo_tankWar3D
        public List <MapEventCondition> Conditions2;                                  //间隔触发条件

        public override void Read(XmlNode os)
        {
            foreach (XmlNode current in XmlObject.GetChilds(os))
            {
                switch (current.Name)
                {
                case "Type":
                    this.Type = (MapTriggerType)ReadInt(current);
                    break;

                case "Id":
                    this.Id = ReadInt(current);
                    break;

                case "Active":
                    this.Active = ReadBool(current);
                    break;

                case "Relation1":
                    this.Relation1 = (ConditionRelationType)ReadInt(current);
                    break;

                case "Relation2":
                    this.Relation2 = (ConditionRelationType)ReadInt(current);
                    break;

                case "Conditions1":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapEventCondition data = new MapEventCondition();
                        data.Read(pNode);
                        Conditions1.Add(data);
                    });
                    break;

                case "Conditions2":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapEventCondition data = new MapEventCondition();
                        data.Read(pNode);
                        Conditions2.Add(data);
                    });
                    break;

                case "TriggerNum":
                    this.TriggerNum = ReadInt(current);
                    break;

                case "TriggerInterval":
                    this.TriggerInterval = ReadFloat(current);
                    break;

                case "TriggerDelay":
                    this.TriggerDelay = ReadFloat(current);
                    break;
                }
            }
        }
コード例 #3
0
ファイル: MapPortal.cs プロジェクト: mengtest/demo_tankWar3D
        public override void Read(XmlNode os)
        {
            foreach (XmlNode current in XmlObject.GetChilds(os))
            {
                switch (current.Name)
                {
                case "Id":
                    this.Id = ReadInt(current);
                    break;

                case "RegionID":
                    this.RegionID = ReadInt(current);
                    break;

                case "DestMapID":
                    this.DestMapID = ReadInt(current);
                    break;

                case "DestPos":
                    this.DestPos = ReadVector3(current);
                    break;

                case "DisplayText":
                    this.DisplayText = ReadBool(current);
                    break;

                case "PortalName":
                    this.PortalName = ReadString(current);
                    break;

                case "Center":
                    this.Center = ReadVector3(current);
                    break;

                case "Euler":
                    this.Euler = ReadVector3(current);
                    break;

                case "ConditionRelation":
                    this.ConditionRelation = (ConditionRelationType)ReadInt(current);
                    break;

                case "OpenLevel":
                    this.OpenLevel = XmlObject.ReadInt(current);
                    break;

                case "OpenItemID":
                    this.OpenItemID = XmlObject.ReadInt(current);
                    break;

                case "OpenVIP":
                    this.OpenVIP = XmlObject.ReadInt(current);
                    break;
                }
            }
        }
コード例 #4
0
        public override void Import(XmlObject pData, bool pBuild)
        {
            MapPortal data = pData as MapPortal;

            if (data == null)
            {
                return;
            }

            Id          = data.Id;
            OpenItemID  = data.OpenItemID;
            OpenLevel   = data.OpenLevel;
            OpenVIP     = data.OpenVIP;
            PortalName  = data.PortalName;
            DestMapID   = data.DestMapID;
            DestPos     = data.DestPos;
            DisplayText = data.DisplayText;
            Relation    = data.ConditionRelation;
            Position    = data.Center;
            this.Build();
            this.SetName();

            if (Application.isPlaying)
            {
                HolderRegion pHolder = GameEntry.Level.GetHolder(MapHolderType.Region) as HolderRegion;

                if (pHolder != null)
                {
                    this.Region = pHolder.FindElement(data.RegionID);
                }

                if (Region != null)
                {
                    Position = data.Center;
                    Euler    = data.Euler;
                    Region.onTriggerEnter = onTriggerEnter;
                }
            }
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            LevelEvent pElem = target as LevelEvent;

            MapTriggerType pType = (MapTriggerType)EditorGUILayout.EnumPopup("触发事件类型", pElem.Type);

            if (pType != pElem.Type)
            {
                pElem.Type = pType;
                pElem.SetName();
            }

            int pTypeId = EditorGUILayout.IntField("触发事件类型ID", pElem.TypeId);

            if (pTypeId != pElem.TypeId)
            {
                pElem.TypeId = pTypeId;
                pElem.SetName();
            }

            bool pActive = EditorGUILayout.Toggle("激活或者销毁", pElem.Active);

            if (pActive != pElem.Active)
            {
                pElem.Active = pActive;
            }

            ConditionRelationType pR1 = (ConditionRelationType)EditorGUILayout.EnumPopup("首次触发条件之间关系", pElem.Relation1);

            if (pR1 != pElem.Relation1)
            {
                pElem.Relation1 = pR1;
            }

            float pTriggerDelay = EditorGUILayout.FloatField("触发延迟", pElem.TriggerDelay);

            if (pElem.TriggerDelay != pTriggerDelay)
            {
                pElem.TriggerDelay = pTriggerDelay;
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("首次触发条件");
            if (UnityEngine.GUILayout.Button("添加"))
            {
                pElem.Conditions1.Add(new MapEventCondition());
            }
            EditorGUILayout.EndHorizontal();

            int pDeleteIndex1 = -1;

            for (int i = 0; i < pElem.Conditions1.Count; i++)
            {
                EditorGUILayout.Space();
                EditorGUIUtility.labelWidth = 100;
                MapEventCondition data = pElem.Conditions1[i];
                EditorGUILayout.LabelField("条件" + (i + 1));
                EditorGUIUtility.labelWidth = 100;
                TriggerConditionType p = (TriggerConditionType)EditorGUILayout.EnumPopup("类型", data.Type);
                if (p != data.Type)
                {
                    data.Type = p;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth = 100;
                string s = EditorGUILayout.TextField("参数", data.Args);
                if (s != data.Args)
                {
                    data.Args = s;
                }

                if (UnityEngine.GUILayout.Button("删除"))
                {
                    pDeleteIndex1 = i;
                }
                EditorGUILayout.EndHorizontal();
            }

            if (pDeleteIndex1 >= 0)
            {
                pElem.Conditions1.RemoveAt(pDeleteIndex1);
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            bool pUseTriggerInterval = EditorGUILayout.Toggle("是否间隔触发", pElem.UseIntervalTrigger);

            if (pElem.UseIntervalTrigger != pUseTriggerInterval)
            {
                pElem.UseIntervalTrigger = pUseTriggerInterval;
            }
            if (pElem.UseIntervalTrigger == false)
            {
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("间隔触发条件");
            if (UnityEngine.GUILayout.Button("添加"))
            {
                pElem.Conditions2.Add(new MapEventCondition());
            }
            EditorGUILayout.EndHorizontal();

            int pTriggerNum = EditorGUILayout.IntField("间隔触发次数(<=0代表无限)", pElem.TriggerNum);

            if (pElem.TriggerNum != pTriggerNum)
            {
                pElem.TriggerNum = pTriggerNum;
            }

            float pTriggerInterval = EditorGUILayout.FloatField("触发间隔时间", pElem.TriggerInterval);

            if (pElem.TriggerInterval != pTriggerInterval)
            {
                pElem.TriggerInterval = pTriggerInterval;
            }

            int pDeleteIndex2 = -1;

            for (int i = 0; i < pElem.Conditions2.Count; i++)
            {
                EditorGUILayout.Space();
                MapEventCondition    data = pElem.Conditions2[i];
                TriggerConditionType p    = (TriggerConditionType)EditorGUILayout.EnumPopup(GlobalTools.Format("条件{0}:  类型", i + 1), data.Type);
                if (p != data.Type)
                {
                    data.Type = p;
                }
                string s = EditorGUILayout.TextField("参数", data.Args);
                if (s != data.Args)
                {
                    data.Args = s;
                }

                if (UnityEngine.GUILayout.Button("删除"))
                {
                    pDeleteIndex2 = i;
                }
            }

            if (pDeleteIndex2 >= 0)
            {
                pElem.Conditions2.RemoveAt(pDeleteIndex2);
            }
        }
コード例 #6
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            LevelPortal pElem = target as LevelPortal;

            int pDestID = EditorGUILayout.IntField("目标区域ID", pElem.DestMapID);
            if (pDestID != pElem.DestMapID)
            {
                pElem.DestMapID = pDestID;
                pElem.Build();
            }

            bool pIsDisplayText = EditorGUILayout.Toggle("显示文字", pElem.DisplayText);
            if (pIsDisplayText != pElem.DisplayText)
            {
                pElem.DisplayText = pIsDisplayText;
                pElem.Build();
            }

            string pPortalName = EditorGUILayout.TextField("传送门名字",pElem.PortalName);
            if (pPortalName != pElem.PortalName)
            {
                pElem.PortalName = pPortalName;
                pElem.Build();
            }

            EditorGUILayout.Space();
            EditorGUILayout.IntField("特效ID", pElem.SerialId);

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("传送所需条件之间的关系,当一个条件值为-1时不参与");
            ConditionRelationType pRelation = (ConditionRelationType)EditorGUILayout.EnumPopup(string.Empty, pElem.Relation);
            if (pRelation != pElem.Relation)
            {
                pElem.Relation = pRelation;
            }
            EditorGUILayout.EndVertical();

            int pOpenLevel = EditorGUILayout.IntField("传送所需等级", pElem.OpenLevel);
            if (pOpenLevel != pElem.OpenLevel)
            {
                pElem.OpenLevel = pOpenLevel;
            }

            int pOpenItemID = EditorGUILayout.IntField("传送所需所需物品ID", pElem.OpenItemID);
            if (pOpenItemID != pElem.OpenItemID)
            {
                pElem.OpenItemID = pOpenItemID;
            }

            int pOpenVIP = EditorGUILayout.IntField("传送所需VIP等级", pElem.OpenVIP);
            if (pOpenVIP != pElem.OpenVIP)
            {
                pElem.OpenVIP = pOpenVIP;
            }

            EditorGUILayout.Space();
            LevelRegion pRegion = (LevelRegion)EditorGUILayout.ObjectField("传送门触发器", pElem.Region, typeof(LevelRegion), true);
            if(pRegion!=pElem.Region)
            {
                pElem.Region = pRegion;
            }
            EditorGUILayout.LabelField("使用触发器ID", pElem.RegionID.ToString());
        }