Ejemplo n.º 1
0
		/// <summary>
		/// Change the current action
		/// </summary>
		/// <param name="action">Action handle</param>
		void SetAction(ActionBase action)
		{
			// Dispose disposable controls
			foreach (var ctrl in ActionPropertiesBox.Controls)
			{
				if (ctrl is IDisposable)
					((IDisposable)ctrl).Dispose();
			}
			ActionPropertiesBox.Controls.Clear();



			if (Script == null)
				return;

			Script.Action = action;

			if (action == null)
				return;

			ActionBaseControl basectrl = null;

			if (action is EnableTarget)
			{
				basectrl = new EnableTargetControl(action as EnableTarget, Dungeon);
			}
			else if (action is DisableTarget)
			{
				basectrl = new DisableTargetControl(action as DisableTarget, Dungeon);
			}
			else if (action is ToggleTarget)
			{
				basectrl = new ToggleTargetControl(action as ToggleTarget, Dungeon);
			}
			else if (action is ActivateTarget)
			{
				basectrl = new ActivateTargetControl(action as ActivateTarget, Dungeon);
			}
			else if (action is DeactivateTarget)
			{
				basectrl = new DeactivateTargetControl(action as DeactivateTarget, Dungeon);
			}
			else if (action is Teleport)
			{
				basectrl = new TeleportControl(action as Teleport, Dungeon);
			}
			else if (action is ChangePicture)
			{
				basectrl = new ChangePictureControl(action as ChangePicture);
			}
			else if (action is ChangeText)
			{
				basectrl = new ChangeTextControl(action as ChangeText);
			}
			else if (action is DisableChoice)
			{
				basectrl = new DisableChoiceControl(action as DisableChoice);
			}
			else if (action is EnableChoice)
			{
				basectrl = new EnableChoiceControl(action as EnableChoice);
			}
			else if (action is EndChoice)
			{
				basectrl = new EndChoiceControl(action as EndChoice);
			}
			else if (action is EndDialog)
			{
				basectrl = new EndDialogControl(action as EndDialog);
			}
			else if (action is GiveExperience)
			{
				basectrl = new GiveExperienceControl(action as GiveExperience);
			}
			else if (action is GiveItem)
			{
				basectrl = new GiveItemControl(action as GiveItem);
			}
			else if (action is Healing)
			{
				basectrl = new HealingControl(action as Healing);
			}
			else if (action is JoinCharacter)
			{
				basectrl = new JoinCharacterControl(action as JoinCharacter);
			}
			else if (action is DisplayMessage)
			{
				basectrl = new DisplayMessageControl(action as DisplayMessage);
			}
			else if (action is SetTo)
			{
				basectrl = new SetToControl(action as SetTo, Dungeon);
			}
			else if (action is SpawnMonster)
			{
				basectrl = new SpawnMonsterControl(action as SpawnMonster, Dungeon);
			}
			else
			{
			}

			if (basectrl == null)
				return;

			basectrl.Dock = DockStyle.Fill;
			ActionPropertiesBox.Controls.Add(basectrl);


		}
Ejemplo n.º 2
0
        /// <summary>
        /// Change the current action
        /// </summary>
        /// <param name="action">Action handle</param>
        void SetAction(ActionBase action)
        {
            // Dispose disposable controls
            foreach (var ctrl in ActionPropertiesBox.Controls)
            {
                if (ctrl is IDisposable)
                {
                    ((IDisposable)ctrl).Dispose();
                }
            }
            ActionPropertiesBox.Controls.Clear();



            if (Script == null)
            {
                return;
            }

            Script.Action = action;

            if (action == null)
            {
                return;
            }

            ActionBaseControl basectrl = null;

            if (action is EnableTarget)
            {
                basectrl = new EnableTargetControl(action as EnableTarget, Dungeon);
            }
            else if (action is DisableTarget)
            {
                basectrl = new DisableTargetControl(action as DisableTarget, Dungeon);
            }
            else if (action is ToggleTarget)
            {
                basectrl = new ToggleTargetControl(action as ToggleTarget, Dungeon);
            }
            else if (action is ActivateTarget)
            {
                basectrl = new ActivateTargetControl(action as ActivateTarget, Dungeon);
            }
            else if (action is DeactivateTarget)
            {
                basectrl = new DeactivateTargetControl(action as DeactivateTarget, Dungeon);
            }
            else if (action is Teleport)
            {
                basectrl = new TeleportControl(action as Teleport, Dungeon);
            }
            else if (action is ChangePicture)
            {
                basectrl = new ChangePictureControl(action as ChangePicture);
            }
            else if (action is ChangeText)
            {
                basectrl = new ChangeTextControl(action as ChangeText);
            }
            else if (action is DisableChoice)
            {
                basectrl = new DisableChoiceControl(action as DisableChoice);
            }
            else if (action is EnableChoice)
            {
                basectrl = new EnableChoiceControl(action as EnableChoice);
            }
            else if (action is EndChoice)
            {
                basectrl = new EndChoiceControl(action as EndChoice);
            }
            else if (action is EndDialog)
            {
                basectrl = new EndDialogControl(action as EndDialog);
            }
            else if (action is GiveExperience)
            {
                basectrl = new GiveExperienceControl(action as GiveExperience);
            }
            else if (action is GiveItem)
            {
                basectrl = new GiveItemControl(action as GiveItem);
            }
            else if (action is Healing)
            {
                basectrl = new HealingControl(action as Healing);
            }
            else if (action is JoinCharacter)
            {
                basectrl = new JoinCharacterControl(action as JoinCharacter);
            }
            else if (action is DisplayMessage)
            {
                basectrl = new DisplayMessageControl(action as DisplayMessage);
            }
            else if (action is SetTo)
            {
                basectrl = new SetToControl(action as SetTo, Dungeon);
            }
            else if (action is SpawnMonster)
            {
                basectrl = new SpawnMonsterControl(action as SpawnMonster, Dungeon);
            }
            else
            {
            }

            if (basectrl == null)
            {
                return;
            }

            basectrl.Dock = DockStyle.Fill;
            ActionPropertiesBox.Controls.Add(basectrl);
        }