Ejemplo n.º 1
0
    private void SetupLegion(GameObject targetLegion)
    {
        // TODO
        EDUtilFunctions.EditSerializedObject <UserLegionCtrl>(
            targetLegion,
            (ser) =>
        {
            GameObject user1 = targetLegion.GetChild(0).gameObject;
            GameObject user2 = targetLegion.GetChild(1).gameObject;
            GameObject user3 = targetLegion.GetChild(2).gameObject;
            GameObject user4 = targetLegion.GetChild(3).gameObject;

            //
            SerializedProperty uiUserNo1   = ser.FindProperty("m_uiUserNo1");
            uiUserNo1.objectReferenceValue = user1.FindChild("UserUnitCtrl").FindChild("UIUserNo").GetComponent <UIBillboard>();
            SerializedProperty uiUserNo2   = ser.FindProperty("m_uiUserNo2");
            uiUserNo2.objectReferenceValue = user2.FindChild("UserUnitCtrl").FindChild("UIUserNo").GetComponent <UIBillboard>();
            SerializedProperty uiUserNo3   = ser.FindProperty("m_uiUserNo3");
            uiUserNo3.objectReferenceValue = user3.FindChild("UserUnitCtrl").FindChild("UIUserNo").GetComponent <UIBillboard>();
            SerializedProperty uiUserNo4   = ser.FindProperty("m_uiUserNo4");
            uiUserNo4.objectReferenceValue = user4.FindChild("UserUnitCtrl").FindChild("UIUserNo").GetComponent <UIBillboard>();

            SerializedProperty uiMagazine1   = ser.FindProperty("m_uiMagazine1");
            uiMagazine1.objectReferenceValue = user1.FindChild("UserUnitCtrl").FindChild("UIMagazine").GetComponent <UIBillboard>();
            SerializedProperty uiMagazine2   = ser.FindProperty("m_uiMagazine2");
            uiMagazine2.objectReferenceValue = user2.FindChild("UserUnitCtrl").FindChild("UIMagazine").GetComponent <UIBillboard>();
            SerializedProperty uiMagazine3   = ser.FindProperty("m_uiMagazine3");
            uiMagazine3.objectReferenceValue = user3.FindChild("UserUnitCtrl").FindChild("UIMagazine").GetComponent <UIBillboard>();
            SerializedProperty uiMagazine4   = ser.FindProperty("m_uiMagazine4");
            uiMagazine4.objectReferenceValue = user4.FindChild("UserUnitCtrl").FindChild("UIMagazine").GetComponent <UIBillboard>();
        });

        GameObject magazineUIRenders = GameObject.Find("MagazineUIRenderLegion");

        for (int i = 0; i < magazineUIRenders.GetChildCount(); ++i)
        {
            GameObject user = targetLegion.GetChild(i).gameObject;
            EDUtilFunctions.EditSerializedObject <MeshUIMagazine>(
                magazineUIRenders.GetChild(i),
                (ser) =>
            {
                ser.FindProperty("m_magazine").objectReferenceValue = user.GetComponentInChildren <LauncherMagazine>();
            });
        }
    }
Ejemplo n.º 2
0
    private void UpdateUserPrefab(UserLegionSetupper setupper)
    {
        EDUtilFunctions.EditApplySerializedPrefab <CharAnimateCtrl>(
            setupper.m_baseUserCtrl,
            (ser) =>
        {
            ser.FindProperty("m_moveSpeed").floatValue = setupper.m_moveSpeed;
            ser.FindProperty("m_jumpPower").floatValue = setupper.m_jumpPower;
        });

        EDUtilFunctions.EditApplySerializedPrefab <LauncherCtrl>(
            setupper.m_baseUserCtrl,
            (ser) =>
        {
            ser.FindProperty("m_pitchSpeed").floatValue     = setupper.m_pitchSpeed;
            ser.FindProperty("m_minPitchAngle").floatValue  = setupper.m_minPitchAngle;
            ser.FindProperty("m_maxPitchAngle").floatValue  = setupper.m_maxPitchAngle;
            ser.FindProperty("m_yawSpeed").floatValue       = setupper.m_yawSpeed;
            ser.FindProperty("m_shotPower").floatValue      = setupper.m_shotPower;
            ser.FindProperty("m_shot3WayAngle").floatValue  = setupper.m_shot3WayAngle;
            ser.FindProperty("m_knockbackTime").floatValue  = setupper.m_knockbackTime;
            ser.FindProperty("m_chargeShotTime").floatValue = setupper.m_chargeShotTime;
        });

        EDUtilFunctions.EditApplySerializedPrefab <LauncherMagazine>(
            setupper.m_baseUserCtrl,
            (ser) =>
        {
            SerializedProperty reloadTime = ser.FindProperty("m_reloadTime");
            reloadTime.floatValue         = setupper.m_reloadTime;
        });

        EDUtilFunctions.EditApplySerializedPrefab <UserCameraAutoCtrl>(
            setupper.m_baseUserCamera,
            (ser) =>
        {
            SerializedProperty rotateSpeed   = ser.FindProperty("m_rotateSpeed");
            rotateSpeed.floatValue           = setupper.m_cameraRotateSpeed;
            SerializedProperty pivotLerpTime = ser.FindProperty("m_pivotLerpTime");
            pivotLerpTime.floatValue         = setupper.m_cameraPivotLerpTime;
        });
    }
    private void EditStrategySlotValues(ref SerializedProperty slot, bool isNewcomer)
    {
        switch ((GuestPopStrategy.PopStrategyType)slot.FindPropertyRelative("m_strategyType").enumValueIndex)
        {
        case GuestPopStrategy.PopStrategyType.Wait:
            slot.FindPropertyRelative("m_values").ClearArray();
            slot.FindPropertyRelative("m_fvalues").ClearArray();
            break;

        case GuestPopStrategy.PopStrategyType.Standard:
            SerializedProperty values  = slot.FindPropertyRelative("m_values");
            SerializedProperty fvalues = slot.FindPropertyRelative("m_fvalues");
            if (isNewcomer)
            {
                int arraySize = 1;
                EDUtilFunctions.ResizeConstArray(ref values, arraySize);
                EDUtilFunctions.ResizeConstArray(ref fvalues, arraySize);
            }
            fvalues.GetArrayElementAtIndex(0).floatValue = EditorGUILayout.FloatField("出現間隔(Sec)", fvalues.GetArrayElementAtIndex(0).floatValue);
            values.GetArrayElementAtIndex(0).intValue    = EditorGUILayout.IntField("同時出現数(Num)", values.GetArrayElementAtIndex(0).intValue).MinLimitedOne();
            break;
        }
    }
    public override void OnInspectorGUI()
    {
        GuestPopDestinationCtrl gen = target as GuestPopDestinationCtrl;
        SerializedObject        ser = new SerializedObject(gen);

        ser.Update();

        {
            float     radius        = EditorGUILayout.FloatField("直径", gen.m_radius);
            Transform transEditMesh = gen.transform.FindChild("EditMesh");
            if (transEditMesh != null)
            {
                transEditMesh.localScale = new Vector3(radius, transEditMesh.localScale.y, radius);
            }
            else
            {
                EditorGUILayout.HelpBox("EditMeshがありません", MessageType.Warning);
            }
            ser.FindProperty("m_radius").floatValue = radius;
        }

        m_param.Invoke(
            "お客さんのパラメータ",
            () =>
        {
            SerializedProperty param = ser.FindProperty("m_param");
            EDUtilFunctions.ResizeConstArray(ref param, GuestConstParam.SumGuestType);

            EditorGUILayout.LabelField("キャパシティ");
            {
                EditorGUI.indentLevel++;
                SerializedProperty cap0 = param.GetArrayElementAtIndex(0).FindPropertyRelative("m_capacity");
                SerializedProperty cap1 = param.GetArrayElementAtIndex(1).FindPropertyRelative("m_capacity");
                SerializedProperty cap2 = param.GetArrayElementAtIndex(2).FindPropertyRelative("m_capacity");
                SerializedProperty cap3 = param.GetArrayElementAtIndex(3).FindPropertyRelative("m_capacity");
                cap0.intValue           = EditorGUILayout.IntField("通常", cap0.intValue);
                cap1.intValue           = EditorGUILayout.IntField("のんびり", cap1.intValue);
                cap2.intValue           = EditorGUILayout.IntField("せっかち", cap2.intValue);
                cap3.intValue           = EditorGUILayout.IntField("居残る", cap3.intValue);
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.LabelField("プライオリティ");
            {
                EditorGUI.indentLevel++;
                SerializedProperty pri0 = param.GetArrayElementAtIndex(0).FindPropertyRelative("m_priority");
                SerializedProperty pri1 = param.GetArrayElementAtIndex(1).FindPropertyRelative("m_priority");
                SerializedProperty pri2 = param.GetArrayElementAtIndex(2).FindPropertyRelative("m_priority");
                SerializedProperty pri3 = param.GetArrayElementAtIndex(3).FindPropertyRelative("m_priority");
                pri0.intValue           = EditorGUILayout.IntField("通常", pri0.intValue).MinLimitedZero();
                pri1.intValue           = EditorGUILayout.IntField("のんびり", pri1.intValue).MinLimitedZero();
                pri2.intValue           = EditorGUILayout.IntField("せっかち", pri2.intValue).MinLimitedZero();
                pri3.intValue           = EditorGUILayout.IntField("居残る", pri3.intValue).MinLimitedZero();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.LabelField("残人数");
            {
                EditorGUI.indentLevel++;
                SerializedProperty num0 = param.GetArrayElementAtIndex(0).FindPropertyRelative("m_num");
                SerializedProperty num1 = param.GetArrayElementAtIndex(1).FindPropertyRelative("m_num");
                SerializedProperty num2 = param.GetArrayElementAtIndex(2).FindPropertyRelative("m_num");
                SerializedProperty num3 = param.GetArrayElementAtIndex(3).FindPropertyRelative("m_num");
                EditorGUILayout.IntField("通常", num0.intValue);
                EditorGUILayout.IntField("のんびり", num1.intValue);
                EditorGUILayout.IntField("せっかち", num2.intValue);
                EditorGUILayout.IntField("居残る", num3.intValue);
                EditorGUI.indentLevel--;
            }
        });

        m_slotStrategy.Invoke(
            "戦略データ",
            () =>
        {
            SerializedProperty slotStrategy = ser.FindProperty("m_slotStrategy");
            EDUtilFunctions.ResizeArray(ref slotStrategy, "個数");

            if (slotStrategy.arraySize == 0)
            {
                EditorGUILayout.HelpBox("戦略Slotが設定されていません", MessageType.Error);
            }
            for (int i = 0; i < slotStrategy.arraySize; ++i)
            {
                EditorGUILayout.LabelField("戦略Slot" + (i + 1).ToString());
                EditorGUI.indentLevel++;
                GuestPopStrategy.PopStrategyType oldSelectedType = GuestPopStrategy.PopStrategyType.Wait;
                SerializedProperty strategyType = slotStrategy.GetArrayElementAtIndex(i).FindPropertyRelative("m_strategyType");
                if (strategyType != null)
                {
                    oldSelectedType = (GuestPopStrategy.PopStrategyType)strategyType.enumValueIndex;
                }
                GuestPopStrategy.PopStrategyType selectedType = (GuestPopStrategy.PopStrategyType)EditorGUILayout.EnumPopup(
                    "戦略タイプ", oldSelectedType);
                bool isNewcomer = true;
                if (selectedType == oldSelectedType)
                {
                    isNewcomer = false;
                }
                strategyType.enumValueIndex = (int)selectedType;
                SerializedProperty time     = slotStrategy.GetArrayElementAtIndex(i).FindPropertyRelative("m_time");
                time.floatValue             = EditorGUILayout.FloatField("実行時間", time.floatValue);
//                    gen.m_slotStrategy[i].m_strategy = GuestPopStrategy.CreatePopStrategy(selectedType);
                SerializedProperty slot = slotStrategy.GetArrayElementAtIndex(i);
                EditStrategySlotValues(ref slot, isNewcomer);
                EditorGUI.indentLevel--;
            }
        });

        ser.FindProperty("m_isLoop").boolValue = EditorGUILayout.Toggle("戦略データはループするか?", gen.m_isLoop);

        m_costPointer.Invoke(
            "各PopPointのコスト",
            () =>
        {
            GuestPopPointerCtrl[] table = gen.GetComponentsInChildren <GuestPopPointerCtrl>();
            if (table.Length == 0)
            {
                EditorGUILayout.HelpBox("PopPointが設定されていません", MessageType.Error);
            }
            if (GUILayout.Button("PopPointを生成"))
            {
                GameObject obj = GameObject.Instantiate(gen.m_popPointer, gen.transform.position, gen.transform.rotation, gen.transform) as GameObject;
                obj.name       = gen.m_popPointer.name + table.Length;
                table          = gen.GetComponentsInChildren <GuestPopPointerCtrl>();
            }
            EditorGUILayout.Space();

            foreach (GuestPopPointerCtrl unit in table)
            {
                SerializedObject serobj = new SerializedObject(unit);
                serobj.Update();
                EditorGUILayout.ObjectField("PopPointer", unit.gameObject, typeof(GameObject), false);
                serobj.FindProperty("m_priority").intValue = EditorGUILayout.IntField("優先度", unit.m_priority).MinLimitedZero();
                serobj.ApplyModifiedProperties();
            }
        });

#if EDIT_BASIS_INSPECTOR
        EditorGUILayout.Space();
        m_basis.Invoke(
            "<Warning>BasisInstance",
            () =>
        {
            EditorGUILayout.HelpBox("ここからは制御しないでください", MessageType.Warning);
            this.DrawDefaultInspector();
        });
#endif
        ser.ApplyModifiedProperties();
    }