Пример #1
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    Length = br.ReadUInt32();
                    Furniture = new EntityFurniture[br.ReadByte()];
                    NPCs = new EntityNPC[br.ReadByte()];
                    Warps = new EntityWarp[br.ReadByte()];
                    Triggers = new EntityTrigger[br.ReadByte()];
                    for (int i = 0; i < Furniture.Length; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(Furniture.Length));
                    for (int i = 0; i < NPCs.Length; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(NPCs.Length));
                    for (int i = 0; i < Warps.Length; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(Warps.Length));
                    for (int i = 0; i < Triggers.Length; i++)
                        Triggers[i] = new EntityTrigger(br.ReadBytes(Triggers.Length));
                    ScriptData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position));
                }
            }
Пример #2
0
        public override void OnInspectorGUI()
        {
            infoBoxStyle = EditorStyles.helpBox;
            Texture2D texture = new Texture2D(1, 1);

            texture.SetPixels(new Color[] { new Color(0.3f, 0.3f, 0.3f) });
            texture.Apply();
            infoBoxStyle.normal.background = texture;
            infoBoxStyle.richText          = true;
            infoBoxStyle.wordWrap          = true;
            infoBoxStyle.fontSize          = 12;
            infoBoxStyle.padding           = new RectOffset(20, 20, 5, 5);
            infoBoxStyle.alignment         = TextAnchor.MiddleLeft;

            serializedObject.Update();

            GUI.enabled = false;
            SerializedProperty prop = serializedObject.FindProperty("m_Script");

            EditorGUILayout.PropertyField(prop, true, new GUILayoutOption[0]);
            GUI.enabled = true;

            EditorGUILayout.PropertyField(serializedObject.FindProperty("triggerType"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("coolDown"));
            EntityTrigger.TriggerType triggerType = (EntityTrigger.TriggerType)serializedObject.FindProperty("triggerType").enumValueIndex;

            if (triggerType == EntityTrigger.TriggerType.LevelChange)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("levelType"));
            }

            if (EntityTrigger.HasTarget(triggerType))
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("forTarget"));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("targetMatchType"));

                InputCondition.MatchType ownerMatchType = (InputCondition.MatchType)serializedObject.FindProperty("targetMatchType").enumValueIndex;
                switch (ownerMatchType)
                {
                case InputCondition.MatchType.TypeGroup:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("typeGroup"));
                    break;

                case InputCondition.MatchType.TypeCategory:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("typeCategory"));
                    break;

                case InputCondition.MatchType.EntityType:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("entityType"));
                    break;
                }
            }

            GUILayout.Space(10f);
            inputConditionList.DoLayoutList();

            GUILayout.Space(10f);
            outputChangeList.DoLayoutList();

            serializedObject.ApplyModifiedProperties();
        }