Esempio n. 1
0
        public void draw()
        {
            var npc = Controller.Instance.IdentifierSummary.getIds <NPC>();

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

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

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

            effect.setDestiny(value.x, value.y);

            EditorGUILayout.HelpBox(TC.get("MoveNPCEffect.Description"), MessageType.Info);
        }
Esempio n. 2
0
        public void draw()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(TC.get("Element.Name28"));
            effect.setTargetId(npc[EditorGUILayout.Popup(Array.IndexOf(npc, effect.getTargetId()), npc)]);
            EditorGUILayout.EndHorizontal();

            xString = effect.getX().ToString();
            yString = effect.getY().ToString();

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

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

            EditorGUILayout.HelpBox(TC.get("MoveNPCEffect.Description"), MessageType.Info);
        }
Esempio 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);
        }