Example #1
0
 public ShrinkPoisonHelper(BattleRoyaleAreaConfig poisonconfig, Action <float, Vector2> poisonCircleChange, Action <float, Vector2> safeCircleChange, Action nosafeareaCallBack)
 {
     m_OutCircleChangeAction = poisonCircleChange;
     m_InCircleChangeAction  = safeCircleChange;
     m_NoSafeAreaCallBack    = nosafeareaCallBack;
     mPoint_outer            = new Vector2(poisonconfig.Mapcenter.x, poisonconfig.Mapcenter.z);
     m_CurrentLevel          = 0;
     m_PoisonConfig          = poisonconfig;
     stableTimeConfig        = m_PoisonConfig.StableTime;
     isStart = true;
 }
Example #2
0
    private void DrawBattleRoyaleAreaGUI()
    {
        m_config = target as BattleRoyaleAreaConfig;
        GetProperties(serializedObject, out var centerPostion, out var poisonConfig, out var stableTime, out var damageDuration);
        EditorGUILayout.PropertyField(centerPostion, new GUIContent("地图中心点"));
        EditorGUILayout.PropertyField(damageDuration, new GUIContent("伤害间隔"));
        EditorGUILayout.PropertyField(stableTime, new GUIContent("安全区出现时间"));
        GUILayout.Space(5);
        var titleStyle = new GUIStyle(EditorStyles.boldLabel);

        titleStyle.fontSize = 20;
        var titleHeight = GUILayout.Height(25);

        EditorGUILayout.LabelField("❉ 各阶段毒圈范围", titleStyle, titleHeight);
        GUILayout.Space(5);
        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
        int insertIndex = -1, delIndex = -1;

        for (int i = 0; i < poisonConfig.arraySize; i++)
        {
            var   element = poisonConfig.GetArrayElementAtIndex(i);
            Color color   = Color.gray;
            if (i == lookIndex)
            {
                color = new Color(0, 201, 255, 0.6f);
            }
            DrawOnePoisonData(element, color, out var insert, out var del, out var look);
            insertIndex = insert ? i : insertIndex;
            delIndex    = del ? i : delIndex;
            lookIndex   = look ? i : lookIndex;
        }

        if (insertIndex >= 0)
        {
            poisonConfig.InsertArrayElementAtIndex(insertIndex + 1);
        }
        if (delIndex >= 0)
        {
            Undo.RecordObject(m_config, "取消删除");
            poisonConfig.DeleteArrayElementAtIndex(delIndex);
        }
        if (poisonConfig.arraySize == 0)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("Add Points"), GUILayout.Height(20)))
            {
                poisonConfig.InsertArrayElementAtIndex(poisonConfig.arraySize);
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();
    }