Exemplo n.º 1
0
    public override void setSettings(DialogSetting settings)
    {
        _settings = (SelectHorizontalSettings)settings;

        ButtonTransform.childrenDestroyAll();

        if (String.IsNullOrEmpty(_settings.Headline))
        {
            HeadlineText.gameObject.SetActive(false);
        }
        else
        {
            HeadlineText.text = _settings.Headline;
            HeadlineText.gameObject.SetActive(true);
        }



        foreach (Option option in _settings.Options.Values)
        {
            if (option.Visible)
            {
                ButtonTextExtended button = Instantiate(ButtonPrefab, ButtonTransform);
                button.Enabled = option.Enabled;
                button.Text    = option.Text;
                button.Button.onClick.AddListener(delegate { option.Commands.execute(_data); submit(); });
            }
        }
    }
Exemplo n.º 2
0
    //private Dictionary<Dialog, DialogCallback> callbacks = new Dictionary<Dialog, DialogCallback>();

    //private Dictionary<Dialog, DialogResolver> resolvers = new Dictionary<Dialog, DialogResolver>();

    private Dialog dialogInstantiate(Dialog dialog, DialogSetting setting)
    {
        Dialog result = Instantiate(dialog, canvas);

        result.setSettings(setting);
        return(result);
    }
Exemplo n.º 3
0
    public override void execute(Data data)
    {
        Dialog dialog = GameManager.Instance.DialogServer.dialogGet(DialogID);

        System.Type   dialogType   = dialog.GetType().BaseType;
        System.Type[] genericTypes = dialogType.GetGenericArguments();

        //DialogSetting setting = Settings.ToObject <genericTypes[0]> ();
        DialogSetting setting = (DialogSetting)JsonConvert.DeserializeObject(Settings.ToString(), genericTypes[0]);

        GameManager.Instance.DialogServer.dialogShow(dialog, setting);
    }
Exemplo n.º 4
0
        private void ShowSettingDialog()
        {
            DialogSetting ds = new DialogSetting();

            ds.ClockOpacity  = (int)(this.Opacity * 100);
            ds.BoxSize       = this.w;
            ds.GridWidth     = this.s;
            ds.AlwaysOnTop   = this.onTop;
            ds.DrawType      = this.drawType;
            ds.IsReverse     = this.is1248;
            ds.ClockLocation = this.Location;
            ds.ClockColor    = Global.ClockColor;
            ds.ShadowColor   = Global.ShadowColor;
            ds.Icon          = this.Icon;

            if (DialogResult.OK == ds.ShowDialog())
            {
                double o = ds.ClockOpacity * 1.0 / 100;
                if (this.Opacity != o)
                {
                    this.Opacity = o;
                }
                if (ds.BoxSize != w ||
                    ds.GridWidth != s)
                {
                    this.w = ds.BoxSize;
                    this.s = ds.GridWidth;
                    ChangeSize();
                }
                Point p = ds.ClockLocation;
                if (Math.Abs(p.X - this.Left) > 5 ||
                    Math.Abs(p.Y - this.Top) > 5)
                {
                    this.Location = p;
                }
                this.is1248   = ds.IsReverse;
                this.onTop    = ds.AlwaysOnTop;
                this.drawType = ds.DrawType;
                ChangeColor(ds.ClockColor, ds.ShadowColor);

                //DrawIcon();
                SaveConfiguration();
            }
        }
Exemplo n.º 5
0
        private IdentKey CreateViewForm(IView view, DialogFormOption options, DialogSetting settings)
        {
            _logger.Debug("CreateViewForm." + view.ToStringExt());
            CheckView(view);

            IdentKey key      = new IdentKey();
            ViewData viewData = new ViewData(view);
            FormBase form     = new FormBase(options);

            form.Owner = _parentForm; //TODO: разобраться на что может повлиять
            form.Tag   = key;
            form.Text  = view.Caption;

            form.Icon = Icon.FromHandle((view.Image as Bitmap).GetHicon());
            Control control = viewData.View.UserControl as Control;
            Size    size    = Size.Add(control.Size, new Size(0, GetFormHeaderHeigth(form)));

            form.Size = size;
            if (settings != null)
            {
                if (settings.Position != null)
                {
                    form.Location = settings.Position;
                }
                if (settings.Size != null)
                {
                    form.Size = settings.Size;
                }
            }
            else
            {
                form.Location = new Point(_parentForm.Location.X + (_parentForm.Width - form.Width) / 2,
                                          _parentForm.Location.Y + (_parentForm.Height - form.Height) / 2);
            }
            view.DialogSetting = form.DialogSetting;

            try
            {
                form.Controls.Add(control);
                control.Dock   = DockStyle.Fill;
                control.Parent = form;

                IDialogResult dialogButtons = view.UserControl as IDialogResult;
                if (dialogButtons != null)
                {
                    IButtonControl okButton = dialogButtons.OkButton as IButtonControl;
                    if (okButton != null)
                    {
                        form.AcceptButton = okButton;
                    }
                    IButtonControl cancelButton = dialogButtons.CancelButton as IButtonControl;
                    if (cancelButton != null)
                    {
                        form.CancelButton = cancelButton;
                    }
                }
                _statusBarButtonController.AddButton(key, viewData.View.Caption, viewData.View.Hint, viewData.View.Image);

                viewData.Form = form;
                _views.Add(key, viewData);
                viewData.View.Ident = key;
                SubscibeToForm(form);
            }
            catch (Exception ex)
            {
                ClearFormResourceSuppress(key, viewData);
                throw ex;
            }

            return(key);
        }
Exemplo n.º 6
0
 public abstract void setSettings(DialogSetting settings);
Exemplo n.º 7
0
 public override void setSettings(DialogSetting settings)
 {
     _settings = (SexSelectDialogSetting)settings;
 }
Exemplo n.º 8
0
 public override void setSettings(DialogSetting settings)
 {
     _settings  = (YesNoDialogSettings)settings;
     Text.text  = _settings.Text;
     Title.text = _settings.Title;
 }
Exemplo n.º 9
0
 public override void setSettings(DialogSetting settings)
 {
     _settings = (AlarmClockDialogSetting)settings;
 }
Exemplo n.º 10
0
    public override void setSettings(DialogSetting settings)
    {
        _settings = (SelectNameDialogSetting)settings;

        inputField.interactable = _settings.FreeChoice;
    }
Exemplo n.º 11
0
    /*private Dialog dialogInstantiate(Dialog dialog, IDictionary<string, string> settings)
     * {
     *  Dialog result = Instantiate(dialog, canvas);
     *  result.setServer(this);
     *  //result.setSettings(settings);
     *  return result;
     * }
     *
     * /*private Dialog dialogInstantiate(string dialogId, IDictionary<string, string> settings)
     * {
     *  return dialogInstantiate(dialogGet(dialogId), settings);
     * }*/

    public void dialogShow(Dialog dialog, DialogSetting setting)
    {
        dialogInstantiate(dialog, setting);
    }
Exemplo n.º 12
0
    /*void Start()
     * {
     *  SelectImageDialogSetting s = new SelectImageDialogSetting();
     *  s.Path = "media/npc/random_f";
     *  setSettings(s);
     * }*/

    public override void setSettings(DialogSetting settings)
    {
        _settings = (SelectImageDialogSetting)settings;

        loadFromFolder(_settings.Path);
    }