public void draw()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(TC.get("Element.Name19"));
            effect.setTargetId(items[EditorGUILayout.Popup(Array.IndexOf(items, effect.getTargetId()), items)]);
            EditorGUILayout.EndHorizontal();

            xString        = effect.getX().ToString();
            yString        = effect.getY().ToString();
            translateSpeed = effect.getTranslateSpeed().ToString();
            scaleSpeed     = effect.getScaleSpeed().ToString();
            floatScale     = effect.getScale();

            xString = EditorGUILayout.TextField(xString);
            xString = Regex.Replace(xString, "[^0-9]", "");

            yString = EditorGUILayout.TextField(yString);
            yString = Regex.Replace(xString, "[^0-9]", "");

            translateSpeed = EditorGUILayout.TextField(translateSpeed);
            translateSpeed = Regex.Replace(translateSpeed, "[^0-9]", "");

            scaleSpeed = EditorGUILayout.TextField(scaleSpeed);
            scaleSpeed = Regex.Replace(scaleSpeed, "[^0-9]", "");

            floatScale = EditorGUILayout.FloatField(floatScale);

            effect.setX(int.Parse(xString));
            effect.setY(int.Parse(yString));
            effect.setTranslateSpeed(int.Parse(translateSpeed));
            effect.setScaleSpeed(int.Parse(scaleSpeed));
            effect.setScale(floatScale);

            EditorGUILayout.HelpBox(TC.get("MoveObjectEffect.Title"), MessageType.Info);
        }
        public override void draw()
        {
            var items = Controller.Instance.IdentifierSummary.getIds <Item>();

            if (items == null || items.Length == 0)
            {
                EditorGUILayout.HelpBox(TC.get("Action.ErrorNoItems"), MessageType.Error);
                return;
            }

            effect.setTargetId(items[EditorGUILayout.Popup(TC.get("Element.Name19"), Array.IndexOf(items, effect.getTargetId()), items)]);

            var value = EditorGUILayout.Vector2IntField("", new Vector2Int(effect.getX(), effect.getY()));

            effect.setX(value.x);
            effect.setY(value.y);
            effect.setScale(EditorGUILayout.FloatField(TC.get("SceneLocation.Scale"), effect.getScale()));
            effect.setAnimated(EditorGUILayout.BeginToggleGroup(TC.get("MoveObjectEffect.Animated"), effect.isAnimated()));
            var prevLabelSize = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 95;
            effect.setTranslateSpeed(EditorGUILayout.IntField(TC.get("MoveObjectEffect.TranslateSpeed"), effect.getTranslateSpeed()));
            effect.setScaleSpeed(EditorGUILayout.IntField(TC.get("MoveObjectEffect.ScaleSpeed"), effect.getScaleSpeed()));
            EditorGUIUtility.labelWidth = prevLabelSize;
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.HelpBox(TC.get("MoveObjectEffect.Title"), MessageType.Info);
        }
Ejemplo n.º 3
0
        public override bool doTool()
        {
            bool effectEdited = false;

            EffectType effectType = effect.getType();

            // If a change has been made
            if (newProperties != null)
            {
                effectEdited = true;
                oldEffect    = (AbstractEffect)effect;

                switch (effectType)
                {
                case EffectType.ACTIVATE:
                    ActivateEffect activateEffect = (ActivateEffect)effect;
                    activateEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    Controller.getInstance().updateVarFlagSummary();
                    break;

                case EffectType.DEACTIVATE:
                    DeactivateEffect deactivateEffect = (DeactivateEffect)effect;
                    deactivateEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    Controller.getInstance().updateVarFlagSummary();
                    break;

                case EffectType.SET_VALUE:
                    SetValueEffect setValueEffect = (SetValueEffect)effect;
                    setValueEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    setValueEffect.setValue(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE]));
                    Controller.getInstance().updateVarFlagSummary();
                    break;

                case EffectType.INCREMENT_VAR:
                    IncrementVarEffect incrementVarEffect = (IncrementVarEffect)effect;
                    incrementVarEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    incrementVarEffect.setIncrement(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE]));
                    Controller.getInstance().updateVarFlagSummary();
                    break;

                case EffectType.DECREMENT_VAR:
                    DecrementVarEffect decrementVarEffect = (DecrementVarEffect)effect;
                    decrementVarEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    decrementVarEffect.setDecrement(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE]));
                    Controller.getInstance().updateVarFlagSummary();
                    break;

                case EffectType.MACRO_REF:
                    MacroReferenceEffect macroEffect = (MacroReferenceEffect)effect;
                    macroEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.CONSUME_OBJECT:
                    ConsumeObjectEffect consumeObjectEffect = (ConsumeObjectEffect)effect;
                    consumeObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.GENERATE_OBJECT:
                    GenerateObjectEffect generateObjectEffect = (GenerateObjectEffect)effect;
                    generateObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.SPEAK_PLAYER:
                    SpeakPlayerEffect speakPlayerEffect = (SpeakPlayerEffect)effect;
                    speakPlayerEffect.setLine((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]);
                    speakPlayerEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]);
                    break;

                case EffectType.SPEAK_CHAR:
                    SpeakCharEffect speakCharEffect = (SpeakCharEffect)effect;
                    speakCharEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    speakCharEffect.setLine((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]);
                    speakCharEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]);
                    break;

                case EffectType.TRIGGER_BOOK:
                    TriggerBookEffect triggerBookEffect = (TriggerBookEffect)effect;
                    triggerBookEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.PLAY_SOUND:
                    PlaySoundEffect playSoundEffect = (PlaySoundEffect)effect;
                    playSoundEffect.setPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]);
                    playSoundEffect.setBackground(bool.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_BACKGROUND]));
                    break;

                case EffectType.PLAY_ANIMATION:
                    PlayAnimationEffect playAnimationEffect = (PlayAnimationEffect)effect;
                    playAnimationEffect.setPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]);
                    playAnimationEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    break;

                case EffectType.MOVE_PLAYER:
                    MovePlayerEffect movePlayerEffect = (MovePlayerEffect)effect;
                    movePlayerEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    break;

                case EffectType.MOVE_NPC:
                    MoveNPCEffect moveNPCEffect = (MoveNPCEffect)effect;
                    moveNPCEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    moveNPCEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    break;

                case EffectType.TRIGGER_CONVERSATION:
                    TriggerConversationEffect triggerConversationEffect = (TriggerConversationEffect)effect;
                    triggerConversationEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.TRIGGER_CUTSCENE:
                    TriggerCutsceneEffect triggerCutsceneEffect = (TriggerCutsceneEffect)effect;
                    triggerCutsceneEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    break;

                case EffectType.TRIGGER_SCENE:
                    TriggerSceneEffect triggerSceneEffect = (TriggerSceneEffect)effect;
                    triggerSceneEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    triggerSceneEffect.setPosition(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    break;

                case EffectType.RANDOM_EFFECT:
                    RandomEffect randomEffect = (RandomEffect)effect;
                    randomEffect.setProbability(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_PROBABILITY]));
                    randomEffect.setPositiveEffect(pos);
                    randomEffect.setNegativeEffect(neg);
                    break;

                case EffectType.WAIT_TIME:
                    WaitTimeEffect waitTimeEffect = (WaitTimeEffect)effect;
                    waitTimeEffect.setTime(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_TIME]));
                    break;

                case EffectType.SHOW_TEXT:
                    ShowTextEffect showTextEffect = (ShowTextEffect)effect;
                    showTextEffect.setText((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]);
                    showTextEffect.setTextPosition(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    showTextEffect.setRgbFrontColor((string)newProperties[EffectsController.EFFECT_PROPERTY_FRONT_COLOR]);
                    showTextEffect.setRgbBorderColor((string)newProperties[EffectsController.EFFECT_PROPERTY_BORDER_COLOR]);
                    showTextEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]);
                    break;

                case EffectType.HIGHLIGHT_ITEM:
                    HighlightItemEffect highlightItemEffect = (HighlightItemEffect)effect;
                    highlightItemEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    highlightItemEffect.setHighlightAnimated((bool)newProperties[EffectsController.EFFECT_PROPERTY_ANIMATED]);
                    highlightItemEffect.setHighlightType((int)newProperties[EffectsController.EFFECT_PROPERTY_HIGHLIGHT_TYPE]);
                    break;

                case EffectType.MOVE_OBJECT:
                    MoveObjectEffect moveObjectEffect = (MoveObjectEffect)effect;
                    moveObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]);
                    moveObjectEffect.setX(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]));
                    moveObjectEffect.setY(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y]));
                    moveObjectEffect.setScale((float)newProperties[EffectsController.EFFECT_PROPERTY_SCALE]);
                    moveObjectEffect.setAnimated((bool)newProperties[EffectsController.EFFECT_PROPERTY_ANIMATED]);
                    moveObjectEffect.setScaleSpeed((int)newProperties[EffectsController.EFFECT_PROPERTY_SCALE_SPEED]);
                    moveObjectEffect.setTranslateSpeed((int)newProperties[EffectsController.EFFECT_PROPERTY_TRANSLATION_SPEED]);
                    break;
                }
                effectEdited = true;
                Controller.getInstance().updatePanel();
            }

            return(effectEdited);
        }