예제 #1
0
        protected override OptionResult Run(GameHitParameters <TTarget> parameters)
        {
            string text = StringInputDialog.Show(Name, GetPrompt(), Value.ToString());

            if (string.IsNullOrEmpty(text))
            {
                return(OptionResult.Failure);
            }

            float value;

            if (!float.TryParse(text, out value))
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                return(OptionResult.Failure);
            }

            Value = Validate(value);

            Common.Notify(ToString());
            return(OptionResult.SuccessRetain);
        }
예제 #2
0
        protected override OptionResult Run(GameHitParameters <TTarget> parameters)
        {
            string text = StringInputDialog.Show(Name, GetPrompt(), GetDisplayValue(true));

            if (string.IsNullOrEmpty(text))
            {
                return(OptionResult.Failure);
            }

            string[] values = text.Split(':');
            if (values.Length != 2)
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Range:Error"));
                return(OptionResult.Failure);
            }

            bool  error;
            TType value1 = Convert(values[0], true, out error);

            if (error)
            {
                return(OptionResult.Failure);
            }

            TType value2 = Convert(values[1], true, out error);

            if (error)
            {
                return(OptionResult.Failure);
            }

            Value = Validate(value1, value2);

            Common.Notify(ToString());
            return(OptionResult.SuccessRetain);
        }
예제 #3
0
 protected override OptionResult Run(GameHitParameters <TTarget> parameters)
 {
     Common.AddAllInteractions();
     return(OptionResult.SuccessClose);
 }
예제 #4
0
 protected override OptionResult Run(GameHitParameters <TTarget> parameters)
 {
     SimpleMessageDialog.Show(Name, Prompt);
     return(OptionResult.SuccessClose);
 }
예제 #5
0
        public override OptionResult Perform(GameHitParameters <TTarget> parameters)
        {
            try
            {
                while (true)
                {
                    IEnumerable <T> allOptions = GetOptions();
                    if (allOptions == null)
                    {
                        return(OptionResult.Failure);
                    }

                    List <T> options = new List <T>();
                    foreach (T option in allOptions)
                    {
                        if (!option.Test(parameters))
                        {
                            continue;
                        }

                        options.Add(option);
                    }

                    CommonSelection <T> .Results selection = new CommonSelection <T>(Name, options).SelectMultiple(NumSelectable);
                    if (selection.Count == 0)
                    {
                        if (selection.mOkayed)
                        {
                            return(OptionResult.SuccessClose);
                        }
                        else
                        {
                            return(OptionResult.Failure);
                        }
                    }

                    bool success   = false;
                    bool retain    = false;
                    bool levelDown = false;

                    foreach (T item in selection)
                    {
                        switch (Run(item, parameters))
                        {
                        case OptionResult.SuccessClose:
                            success = true;
                            break;

                        case OptionResult.SuccessRetain:
                            retain = true;
                            break;

                        case OptionResult.SuccessLevelDown:
                            levelDown = true;
                            break;
                        }
                    }

                    if (levelDown)
                    {
                        return(OptionResult.SuccessRetain);
                    }
                    else if ((success) && (!retain))
                    {
                        return(OptionResult.SuccessClose);
                    }
                }
            }
            catch (Exception e)
            {
                GameHitParameters <TTarget> .Exception(parameters, e);

                return(OptionResult.Failure);
            }
        }
 protected override bool Allow(GameHitParameters <GameObject> parameters)
 {
     return(true);
 }
예제 #7
0
        public OptionResult Perform(IInteractionOptionItem <IActor, TTarget, GameHitParameters <TTarget> > option, GameHitParameters <TTarget> parameters)
        {
            try
            {
                return(Run(option as TOption, parameters));
            }
            catch (Exception e)
            {
                GameHitParameters <TTarget> .Exception(parameters, e);

                return(OptionResult.Failure);
            }
        }
예제 #8
0
 protected virtual OptionResult Run(TOption option, GameHitParameters <TTarget> parameters)
 {
     return(option.Perform(parameters));
 }
예제 #9
0
 public virtual OptionResult Perform(GameHitParameters <TTarget> parameters)
 {
     throw new NotImplementedException();
 }