예제 #1
0
    /// <summary>
    /// 装着する、ギア選択ポップアップをセット
    /// </summary>
    public void Setup(
        SimpleDialog dialog,
        UserPartsData partsData,
        uint gearId,
        Action onReflesh)
    {
        this.dialog     = dialog;
        this.partsData  = partsData;
        this.beforeGear = UserData.Get().gearData.FirstOrDefault(x => x.gearId == gearId && x.partsServerId == this.partsData.serverId);
        this.onReflesh  = onReflesh;

        //パーツに装着出来るギアのタイプ
        var gearType = partsData.itemType == (uint)ItemType.Battery ? GearType.Battery
                     : partsData.itemType == (uint)ItemType.Barrel  ? GearType.Barrel
                     : partsData.itemType == (uint)ItemType.Bullet  ? GearType.Bullet
                     : 0;

        //装着可能なギア一覧(パーツタイプが一致し、どのパーツにも装着されていないもの)
        this.freeGears = UserData.Get().gearData
                         .Where(x => x.gearType == (uint)gearType && !x.partsServerId.HasValue)
                         .ToArray();

        // 所持するギアがない場合(Nullエラーため)
        if (this.beforeGear == null && this.freeGears.Length == 0)
        {
            // 固定されている装着ギアパネルが未装着の場合(ギア未所持)
            this.fastenGearViewItemPrefab.SetNotEquippedPanel();
        }
        // 所持するギアがある場合
        else
        {
            // ギア未装着
            if (gearId == 0)
            {
                // 固定されている装着ギアパネルが未装着の場合(ギア所持)
                this.fastenGearViewItemPrefab.SetNotEquippedPanel();
            }
            // ギアを装着してある場合
            else
            {
                // 固定されている装着ギアパネルにデータロッド
                this.fastenGearViewItemPrefab.SetGearData(beforeGear, null);
                this.unEquipGearButton.gameObject.SetActive(true);

                //装着したギアを外すボタンをロードするため、null空間を生成
                //this.freeGears = new UserGearData[] { null }.Concat(this.freeGears).ToArray();
            }
        }

        // ScrollView生成
        this.gearScrollView.Initialize(
            this.gearScrollViewItemPrefab.gameObject,
            this.freeGears.Length,
            this.LoadGearPrefabData
            );
    }
        private void btnSelFile_Click(object sender, EventArgs e)
        {
            string path = SimpleDialog.OpenFile(null, "Key Files (*.snk)|*.snk|All Files (*.*)|*.*", ".snk", true, Config.StrongKeyFile);

            if (!String.IsNullOrEmpty(path))
            {
                txtKeyFile.Text      = path;
                Config.StrongKeyFile = path;
            }
        }
        public static string OpenReflector(string initDir)
        {
            string path = SimpleDialog.OpenFile("Where is .Net Reflector?", "Reflector.exe|Reflector.exe|Exe files (*.exe)|*.exe", ".exe", true, initDir);

            if (!String.IsNullOrEmpty(path) && File.Exists(path))
            {
                Config.Reflector = path;
            }
            return(path);
        }
    /// <summary>
    /// 内容構築
    /// </summary>
    public override void Set(ProductIcon icon, ProductBase product, SimpleDialog dialog, Action <UserBillingData, UserShopData, ProductIcon, ProductBase> onPurchaseCompleted, Action onNonPurchase)
    {
        base.Set(icon, product, dialog, onPurchaseCompleted, onNonPurchase);

        //CommonIcon表示構築
        this.commonIcon.Set(this.product.addItems[0].itemType, this.product.addItems[0].itemId, false);

        //商品説明
        this.productInfoText.text = this.product.description;
    }
    /// <summary>
    /// 内容構築
    /// </summary>
    public override void Set(ProductBase product, SimpleDialog dialog)
    {
        base.Set(product, dialog);

        //CommonIcon表示構築
        this.commonIcon.Set(this.product.addItems[0].itemType, this.product.addItems[0].itemId, false);

        //商品説明
        this.productInfoText.text = this.product.description;
    }
        private void btnSelectOutputDir_Click(object sender, EventArgs e)
        {
            string path = SimpleDialog.OpenFolder();

            if (!String.IsNullOrEmpty(path))
            {
                txtOutputDir.Text     = path;
                Config.DeobfOutputDir = path;
            }
        }
예제 #7
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="mainScreen">The main screen.</param>
        /// <param name="message">The message.</param>
        /// <returns>Task.</returns>
        public async Task ShowDialog(string mainScreen, string message)
        {
            var dialogView = new SimpleDialog
            {
                Message = { Text = message }
            };
            await DialogHost.Show(dialogView, mainScreen);

            DialogHost.CloseDialogCommand.Execute(true, dialogView);
        }
예제 #8
0
        private void container_edit(object sender, RoutedEventArgs e)
        {
            if ((this.selection is null) || (this.selection.is_category) || (!this.state.items.ContainsKey(this.selection.name)))
            {
                return;
            }
            ElementReference <ItemSpec> item_ref = this.state.items[this.selection.name];

            if (item_ref.ref_count > 0)
            {
                return;
            }
            int idx = this.container_list.SelectedIndex;

            if ((idx < 0) || (idx >= this.containers.Count))
            {
                return;
            }
            ContainerSpec container = this.containers[idx];

            QueryPrompt[] prompts = new QueryPrompt[] {
                new QueryPrompt("Name:", QueryType.STRING, container.name),
                new QueryPrompt("Weight Factor:", QueryType.FLOAT, (double)(container.weight_factor), step: 0.125),
                new QueryPrompt("Weight Capacity:", QueryType.FLOAT, (double)(container.weight_capacity ?? 0)),
            };
            object[] results = SimpleDialog.askCompound("Edit Container", prompts, this);
            if (results is null)
            {
                return;
            }

            string name = results[0] as string;
            double?weight_factor = results[1] as double?, weight_capacity = results[2] as double?;

            if ((name is null) || (weight_factor is null))
            {
                return;
            }
            if (weight_capacity == 0)
            {
                weight_capacity = null;
            }

            container.name            = name;
            container.weight_factor   = (decimal)weight_factor;
            container.weight_capacity = (decimal?)weight_capacity;
            ItemSpecContainerRow row = this.container_rows[idx];

            row._name            = name;
            row._weight_factor   = container.weight_factor.ToString();
            row._weight_capacity = container.weight_capacity.ToString();
            this.container_list.Items.Refresh();
            this.fix_listview_column_widths(this.container_list);
            this.set_dirty();
        }
        public void btnSaveLog_Click(object sender, EventArgs e)
        {
            try
            {
                using (new SimpleWaitCursor())
                {
                    TreeView           treeView1 = _form.TreeView;
                    AssemblyDefinition ad        = _form.TreeViewHandler.GetCurrentAssembly();
                    if (ad == null)
                    {
                        SimpleMessage.ShowInfo("Cannot determine current assembly.");
                        return;
                    }

                    string initFileName = String.Empty;
                    for (int i = 0; i < treeView1.Nodes.Count; i++)
                    {
                        if (ad.Equals(treeView1.Nodes[i].Tag))
                        {
                            initFileName = treeView1.Nodes[i].Text;
                            break;
                        }
                    }
                    initFileName = initFileName + ".log.txt";
                    string initDir = Config.ClassEditorSaveAsDir;
                    if (!Directory.Exists(initDir))
                    {
                        initDir = Environment.CurrentDirectory;
                    }
                    string path = SimpleDialog.OpenFile("Save Log",
                                                        "Text files (*.txt)|*.txt",
                                                        ".txt", false, initDir, initFileName);
                    if (!String.IsNullOrEmpty(path))
                    {
                        Config.ClassEditorSaveAsDir = Path.GetDirectoryName(path);
                    }

                    if (String.IsNullOrEmpty(path))
                    {
                        return;
                    }

                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(txtLog.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                SimpleMessage.ShowException(ex);
            }
        }
        /// <summary>
        /// セットアップ
        /// </summary>
        private void Setup(
            SimpleDialog dialog,
            Master.SingleStageData stageData,
            SinglePlayApi.ClearResponseData response,
            Rank clearRank,
            SinglePlayApi.RewardData[] rewards,
            AssetListLoader loader,
            Action onClose)
        {
            this.dialog         = dialog;
            this.dialog.onClose = onClose;
            this.response       = response;
            this.rewards        = rewards;
            this.loader         = loader;

            //星マーク
            for (int i = 0; i < this.starImage.Length; i++)
            {
                this.starImage[i].enabled = i < (int)clearRank - 2;
            }

            //通常報酬が8個以下なら
            if (this.rewards.Length < 9)
            {
                //非スクロールエリアに報酬アイコンを生成する
                this.horizontalLayoutGroup.gameObject.SetActive(true);
                this.scrollView.gameObject.SetActive(false);

                for (int i = 0; i < this.rewards.Length; i++)
                {
                    var icon = Instantiate(this.rewardIconPrefab, this.horizontalLayoutGroup.transform, false);
                    this.OnUpdateRewardIconView(icon.gameObject, i);
                }
            }
            //通常報酬が9個以上なら
            else
            {
                //スクロールエリアに報酬アイコンを生成する
                this.horizontalLayoutGroup.gameObject.SetActive(true);
                this.scrollView.gameObject.SetActive(true);
                this.scrollView.Initialize(this.rewardIconPrefab.gameObject, this.rewards.Length, this.OnUpdateRewardIconView);
            }

            //タイトルテキスト設定
            this.dialog.titleText.text = Masters.LocalizeTextDB.Get("Result");

            //ステージセレクトへ戻るボタンの追加
            var button = this.dialog.AddOKButton();

            button.text.text = Masters.LocalizeTextDB.Get("ToStageSelect");
            button.onClick   = this.OnClickOKButton;
        }
예제 #11
0
        /// <summary>
        /// Create a new "simple" (text-only) dialog.
        /// </summary>
        /// <param name="displayText">The text that the dialog will display to the player.</param>
        /// <param name="callback">A lua callback that can be associated with the dialog, and will be fired when the dialog is shown to a player.</param>
        /// <returns>The constructed dialog</returns>
        public HybrasylDialog NewDialog(string displayText, string callback = null)
        {
            if (string.IsNullOrEmpty(displayText))
            {
                GameLog.ScriptingError($"NewDialog: Sequence name (first argument) was null / empty");
                return(null);
            }

            var dialog = new SimpleDialog(displayText);

            dialog.SetCallbackHandler(callback);
            return(new HybrasylDialog(dialog));
        }
예제 #12
0
        private async void OpenDialog()
        {
            var viewDialog = new SimpleDialog();

            viewDialog.DataContext = new DialogViewModel();

            //show the dialog
            var result = await DialogHost.Show(viewDialog, "Root", ClosingEventHandler);

            if ((bool)result)
            {
                // 获取输入的值并写入配置
                Console.WriteLine("点击确定");
                Logger.Info("点击确定");
                string ip             = ((DialogViewModel)viewDialog.DataContext).Ip;
                string DatabaseServer = ((DialogViewModel)viewDialog.DataContext).DatabaseServer;
                string DatabaseName   = ((DialogViewModel)viewDialog.DataContext).DatabaseName;
                string Username       = ((DialogViewModel)viewDialog.DataContext).Username;
                string Password       = ((DialogViewModel)viewDialog.DataContext).Password;
                string downloadUrl    = "http://" + ip + ":80/group1/";

                Console.WriteLine("输入IP:" + ip);
                Logger.Info("输入IP = {0}", ip);
                Logger.Info("输入DatabaseServer = {0}", DatabaseServer);
                Logger.Info("输入DatabaseName = {0}", DatabaseName);
                Logger.Info("输入Username = {0}", Username);
                Logger.Info("输入Password = {0}", Password);

                Configuration cf = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                cf.AppSettings.Settings["fastdfs_Nodes"].Value       = ip;
                cf.AppSettings.Settings["fastdfs_DownloadUrl"].Value = downloadUrl;
                cf.AppSettings.Settings["mysql_server"].Value        = DatabaseServer;
                cf.AppSettings.Settings["mysql_database"].Value      = DatabaseName;
                cf.AppSettings.Settings["mysql_user"].Value          = Username;
                cf.AppSettings.Settings["mysql_pwd"].Value           = Password;
                // 保存并刷新
                cf.Save();
                ConfigurationManager.RefreshSection("appSettings");

                // 刷新界面数据
                // Init();
                MessageBox.Show("请手动刷新数据!");
            }
            else
            {
                // 获取配置 还原输入值
                Console.WriteLine("点击取消");
                var ip = ConfigurationManager.AppSettings["fastdfs_Nodes"];
                ((DialogViewModel)viewDialog.DataContext).Ip = ip;
            }
        }
        private void SimpleDialogButton_Click(object sender, RoutedEventArgs e)
        {
            SimpleDialog dialog = CreateSimpleDialog();

            try
            {
                dialog.ShowSimpleDialog();
                //MessageBox.Show(dialog.ShowSimpleDialog().ToString());
            }
            catch
            {
                //dialog.ShowSimpleDialog() returned null
            }
        }
예제 #14
0
        private void SaveAsOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            var diag     = new SimpleDialog();
            var nameText = new TextBox();
            var desText  = new TextBox()
            {
                TextWrapping = TextWrapping.Wrap, AcceptsReturn = true, Height = 300
            };
            var saveButton = new Button()
            {
                Content = "Save", Width = 100
            };

            var stack =
                new StackPanel()
            {
                Margin = new Thickness(20, 20, 20, 20)
            }
            .Add(new Label {
                Content    = "Save Hardware",
                FontSize   = 25,
                FontWeight = FontWeights.Bold,
                Margin     = new Thickness(0, 0, 0, 20)
            })
            .Add(new Label()
            {
                Content = "Name"
            })
            .Add(nameText)
            .Add(new Label {
                Content = "Description"
            })
            .Add(desText)
            .Add(
                new StackPanel()
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = new Thickness(0, 20, 0, 0)
            }.Add(
                    saveButton.SetClick(async(o, h) => await SaveAsConfigAsync(nameText.Text, desText.Text)))
                .Add(
                    new Button {
                Content = "Cancel", Width = 100
            }.SetClick((o, args) => diag.CloseDialog())));

            diag.Content = stack;
            _diagManager.ShowDialog(diag);
        }
        private void btnSelectApp_Click(object sender, EventArgs e)
        {
            string initDir = null;

            if (!String.IsNullOrEmpty(txtApp.Text) && File.Exists(txtApp.Text))
            {
                initDir = Path.GetDirectoryName(txtApp.Text);
            }

            string path = SimpleDialog.OpenFile(this.Text, Consts.FilterExeFile, ".exe", true, initDir);

            if (!String.IsNullOrEmpty(path))
            {
                txtApp.Text = path;
            }
        }
예제 #16
0
    /// <summary>
    /// 内容構築
    /// </summary>
    public virtual void Set(ProductBase product, SimpleDialog dialog)
    {
        this.product = product;

        //メッセージ設定
        this.SetMessage();

        //コインコンテンツ設定
        this.SetCoinContent();

        //ジェムコンテンツ設定
        this.SetGemContent();

        //ボタンの設定
        dialog.AddOKButton().onClick = dialog.Close;
    }
예제 #17
0
        private void container_add(object sender, RoutedEventArgs e)
        {
            if ((this.selection is null) || (this.selection.is_category) || (!this.state.items.ContainsKey(this.selection.name)))
            {
                return;
            }
            ElementReference <ItemSpec> item_ref = this.state.items[this.selection.name];

            if (item_ref.ref_count > 0)
            {
                return;
            }
            QueryPrompt[] prompts = new QueryPrompt[] {
                new QueryPrompt("Name:", QueryType.STRING),
                new QueryPrompt("Weight Factor:", QueryType.FLOAT, 1.0, step: 0.125),
                new QueryPrompt("Weight Capacity:", QueryType.FLOAT),
            };
            object[] results = SimpleDialog.askCompound("Add Container", prompts, this);
            if (results is null)
            {
                return;
            }

            string name = results[0] as string;
            double?weight_factor = results[1] as double?, weight_capacity = results[2] as double?;

            if ((name is null) || (weight_factor is null))
            {
                return;
            }
            if (weight_capacity == 0)
            {
                weight_capacity = null;
            }

            ContainerSpec container = new ContainerSpec(name, (decimal)weight_factor, (decimal?)weight_capacity);

            this.containers.Add(container);
            this.container_rows.Add(new ItemSpecContainerRow(container.name, container.weight_factor.ToString(), container.weight_capacity.ToString()));
            this.container_list.Items.Refresh();
            this.fix_listview_column_widths(this.container_list);
            this.set_dirty();
        }
예제 #18
0
        private void prop_edit(object sender, RoutedEventArgs e)
        {
            if ((this.selection is null) || (this.selection.is_category) || (!this.state.items.ContainsKey(this.selection.name)))
            {
                return;
            }
            int idx = this.prop_list.SelectedIndex;

            if ((idx < 0) || (idx >= this.property_rows.Count))
            {
                return;
            }
            ItemSpecPropertyRow row = this.property_rows[idx];

            QueryPrompt[] prompts = new QueryPrompt[] {
                new QueryPrompt("Name:", QueryType.STRING, row.name),
                new QueryPrompt("Value:", QueryType.STRING, row.value),
            };
            object[] results = SimpleDialog.askCompound("Edit Property", prompts, this);
            if (results is null)
            {
                return;
            }

            string name = results[0] as string, value = results[1] as string;

            if ((name is null) || (value is null))
            {
                return;
            }

            if (name != row.name)
            {
                this.properties.Remove(row.name);
            }
            this.properties[name] = value;
            row._name             = name;
            row._value            = value;
            this.property_rows.Sort((x, y) => x.name.CompareTo(y.name));
            this.prop_list.Items.Refresh();
            this.fix_listview_column_widths(this.prop_list);
            this.set_dirty();
        }
예제 #19
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var str = "";

            if (value != null)
            {
                str = (string)value;
            }
            var form = new SimpleDialog(Localizer.GetString("TitleInput"), Localizer.GetString("MessageEnterText"), true, str)
            {
                InputRichText = true
            };

            if (form.ShowDialog() == DialogResult.Cancel)
            {
                return(value);
            }
            return(form.InputValue);
        }
예제 #20
0
        private void mnuOpenFile_Click(object sender, EventArgs e)
        {
            string initDir = null;

            if (!String.IsNullOrEmpty(_lastOpenDir))
            {
                initDir = _lastOpenDir;
            }
            else
            {
                initDir = SourceDir;
            }
            string file = SimpleDialog.OpenFile("Open File", Consts.FilterAssemblyFile, "", false, initDir);

            if (File.Exists(file))
            {
                _lastOpenDir = Path.GetDirectoryName(file);
                OpenFile(file);
            }
        }
        public IEnumerator StartMappingTexture()
        {
            if (State == AppStates.Scanning)
            {
                State = AppStates.MappingTexture;

                SpatialUnderstanding.Instance.RequestFinishScan();
                while (SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Done)
                {
                    yield return(null);
                }

                TextureMappingManager.Instance.StartTextureMapping();
                MiniatureRoom.GenerateMesh();

                ClearDialog();
                SimpleDialog.ButtonTypeEnum buttons = SimpleDialog.ButtonTypeEnum.OK;
                dialog = SimpleDialog.Open(DialogPrefab, buttons, "Camera Mapping", "Move around and do AirTap.");
            }
        }
예제 #22
0
        private void add_category(object sender, RoutedEventArgs e)
        {
            QueryPrompt[] prompts = new QueryPrompt[] {
                new QueryPrompt("Name:", QueryType.STRING),
                new QueryPrompt("Value Factor:", QueryType.FLOAT, 1.0, step: 0.125),
            };
            object[] results = SimpleDialog.askCompound("Add Category", prompts, this);
            if (results is null)
            {
                return;
            }

            string name = results[0] as string;

            if ((name is null) || (this.state.categories.ContainsKey(name)))
            {
                return;
            }

            this.do_add_category(name, (decimal)(results[1] as double?));
            this.item_list.Items.Refresh();
        }
예제 #23
0
        private void SaveButtonClick(object sender, EventArgs e)
        {
            var dialog = new SimpleDialog(Localizer.GetString("TitleExpressionCreation"),
                                          Localizer.GetString("MessageEnterFormulaComment"), true, SelectedFunction.Description);

            if (dialog.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            var newF = new PerformerCriteriaFunction(SelectedFunction)
            {
                Description = dialog.InputValue
            };

            PerformerCriteriaFunctionCollection.Instance.criterias.Add(newF);
            PerformerCriteriaFunctionCollection.Instance.SelectedFunction = newF;
            PerformerCriteriaFunctionCollection.Instance.WriteToFile();
            if (PerformerCriteriaFunctionCollectionChanged != null)
            {
                PerformerCriteriaFunctionCollectionChanged(this, new EventArgs());
            }
        }
예제 #24
0
    /**<summary> Show player inventory items </summary>*/
    public void ShowInventory()
    {
        // Simple dialog until proper implementation
        inventoryDialog = DialogManager.ShowSimple("Inventory", data.inventory.Select(b => (b.count > 1 ? " " + b.count + " | " : string.Empty) + b.itemData.name + (equippedItems.Count > 0 && equippedItems.Select(x => x.data.id).Contains(b.itemData.id) ? " (equipped)" : "")).ToArray(), true, false,
                                                   (int selectedIndex) =>
        {
            DialogManager.ShowAlert(data.inventory[selectedIndex].itemData.name + " | " + data.inventory[selectedIndex].count, data.inventory[selectedIndex].itemData.description + "\nValue: " + data.inventory[selectedIndex].itemData.value, true,
                                    new DialogManager.DialogButton("Close", () => { }),
                                    new DialogManager.DialogButton("Discard", () =>
            {
                DiscardItem(selectedIndex);
            }),
                                    // Disable hiding for now, uncomment to enable

                                    /*new DialogManager.DialogButton("Hide", () =>
                                     * {
                                     *  DialogManager.ShowAlert("Hide " + data.inventory[selectedIndex].itemData.name + " to world?", "You get rewarded based on the time the item stays hidden and base value of it", true,
                                     *      new DialogManager.DialogButton("No", () => { }),
                                     *      new DialogManager.DialogButton("Yes", () =>
                                     *      {
                                     *          DropItem(selectedIndex);
                                     *      })
                                     *  );
                                     * }),*/
                                    equippedItems.Select(x => x.data.id).Contains(data.inventory[selectedIndex].itemData.id) ?
                                    new DialogManager.DialogButton("Unequip", () =>
            {
                UnequipItem(equippedItems.FindIndex(x => x.data.id == data.inventory[selectedIndex].itemData.id));
            })
                    :
                                    new DialogManager.DialogButton("Equip", () =>
            {
                EquipItem(data.inventory[selectedIndex].itemData);
            })
                                    );
        }
                                                   );
    }
예제 #25
0
        private void prop_add(object sender, RoutedEventArgs e)
        {
            if ((this.selection is null) || (this.selection.is_category) || (!this.state.items.ContainsKey(this.selection.name)))
            {
                return;
            }
            QueryPrompt[] prompts = new QueryPrompt[] {
                new QueryPrompt("Name:", QueryType.STRING),
                new QueryPrompt("Value:", QueryType.STRING),
            };
            object[] results = SimpleDialog.askCompound("Add Property", prompts, this);
            if (results is null)
            {
                return;
            }

            string name = results[0] as string, value = results[1] as string;

            if ((name is null) || (value is null))
            {
                return;
            }

            this.properties[name] = value;
            for (int i = 0; i < this.property_rows.Count; i++)
            {
                if (this.property_rows[i].name == name)
                {
                    this.property_rows.RemoveAt(i);
                    break;
                }
            }
            this.property_rows.Add(new ItemSpecPropertyRow(name, value));
            this.property_rows.Sort((x, y) => x.name.CompareTo(y.name));
            this.prop_list.Items.Refresh();
            this.fix_listview_column_widths(this.prop_list);
            this.set_dirty();
        }
예제 #26
0
        /// <summary>
        /// Another convenience function to generate an "end" sequence where the user must hit close (e.g. a dialog end).
        /// This is useful to make a jumpable end to a previous dialog option.
        /// </summary>
        /// <param name="simpleDialog">The text of the simple dialog.</param>
        /// <param name="callback">An optional Lua callback expression that will be attached to the simple dialog.</param>
        /// <param name="name">An optional name to give the dialog sequence.</param>
        /// <returns>The constructed dialog sequence</returns>
        public HybrasylDialogSequence NewEndSequence(string simpleDialog, string callback = "", string name = null)
        {
            DialogSequence sequence;

            if (name == null)
            {
                sequence = new DialogSequence(Guid.NewGuid().ToString());
            }
            else
            {
                sequence = new DialogSequence(name);
            }

            var dialog = new SimpleDialog(simpleDialog);

            if (!string.IsNullOrEmpty(callback))
            {
                dialog.CallbackExpression = callback;
            }

            sequence.AddDialog(dialog);
            return(new HybrasylDialogSequence(sequence));
        }
예제 #27
0
    //------------------------------- DIALOG LAUNCHING ---------------------------------
    //
    //    Before invoking this application one needs to open any part/empty part in NX
    //    because of the behavior of the blocks.
    //
    //    Make sure the dlx file is in one of the following locations:
    //        1.) From where NX session is launched
    //        2.) $UGII_USER_DIR/application
    //        3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly
    //            recommended. This variable is set to a full directory path to a file
    //            containing a list of root directories for all custom applications.
    //            e.g., UGII_CUSTOM_DIRECTORY_FILE=$UGII_BASE_DIR\ugii\menus\custom_dirs.dat
    //
    //    You can create the dialog using one of the following way:
    //
    //    1. Journal Replay
    //
    //        1) Replay this file through Tool->Journal->Play Menu.
    //
    //    2. USER EXIT
    //
    //        1) Create the Shared Library -- Refer "Block UI Styler programmer's guide"
    //        2) Invoke the Shared Library through File->Execute->NX Open menu.
    //
    //------------------------------------------------------------------------------
    public static void Main()
    {
        SimpleDialog theSimpleDialog = null;

        try
        {
            theSimpleDialog = new SimpleDialog();
            // The following method shows the dialog immediately
            theSimpleDialog.Show();
        }
        catch (Exception ex)
        {
            //---- Enter your exception handling code here -----
            theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
        }
        finally
        {
            if (theSimpleDialog != null)
            {
                theSimpleDialog.Dispose();
            }
            theSimpleDialog = null;
        }
    }
예제 #28
0
    /// <summary>
    /// 表示構築
    /// </summary>
    private void BuildView(MissionApi.MissionProgressResponseData response, SimpleDialog dialog)
    {
        this.response = response;
        this.dialog   = dialog;

        for (int i = 0; i < this.tabGroup.tabList.Count; i++)
        {
            var tab = this.tabGroup.tabList[i] as MissionDialogTab;

            //各タブにミッションリストを割り当て
            var server = (tab.category == MissionApi.Category.StartDash) ? this.response.startDashMissionProgress
                       : (tab.category == MissionApi.Category.Daily)     ? this.response.dailyMission
                       : (tab.category == MissionApi.Category.Total)     ? this.response.totalMission
                       : (tab.category == MissionApi.Category.Event)     ? this.response.eventMissionProgress
                       : null;
            tab.Set(server);

            //ミッションが無いタブは非表示
            tab.gameObject.SetActive(tab.missionList.Length > 0);
        }

        //スクロールビュー構築
        this.missionScrollView.Initialize(this.missionContent.gameObject, this.selectedTab.missionList.Length, this.OnUpdateElement);
    }
예제 #29
0
 public HybrasylDialog NewDialog(String displayText, dynamic callback = null)
 {
     var dialog = new SimpleDialog(displayText);
     dialog.SetCallbackHandler(callback);
     return new HybrasylDialog(dialog);
 }
    /// <summary>
    /// セットアップ
    /// </summary>
    public void Setup(
        SimpleDialog dialog,
        UserPartsData partsData,
        UserGearData beforeGear,
        UserGearData afterGear,
        Action onReflesh,
        Action onCancel)
    {
        this.dialog     = dialog;
        this.yesNo      = this.dialog.AddYesNoButton();
        this.partsData  = partsData;
        this.beforeGear = beforeGear;
        this.afterGear  = afterGear;
        this.onReflesh  = onReflesh;
        this.onCancel   = onCancel;

        //キャンセル時処理登録
        this.yesNo.no.onClick = this.Cancel;

        Master.GearData beforeGearData = (this.beforeGear == null) ? null : Masters.GearDB.FindById(beforeGear.gearId);
        Master.GearData afterGearData  = (this.afterGear == null) ? null : Masters.GearDB.FindById(afterGear.gearId);
        this.beforeGearPanel.SetGearData(beforeGearData);
        this.afterGearPanel.SetGearData(afterGearData);

        //所持コイン数テキスト
        long beforeCoin = (long)UserData.Get().coin;

        this.beforeCoinText.text = string.Format("{0:#,0}", beforeCoin);

        //装着
        if (beforeGearData == null)
        {
            this.coinArea.SetActive(false);
            this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearEquip");
            this.noteRemoveCostText.text = Masters.LocalizeTextDB.GetFormat("NoteGearRemoveCost", afterGearData.rejectCoin);
            this.freeGearRemoveText.text = null;
            this.yesNo.yes.onClick       = this.CallGearSetApi;
        }
        else
        {
            this.noteRemoveCostText.gameObject.SetActive(false);

            // vipでない場合
            if (UserData.Get().vipLevel == 0)
            {
                this.freeGearRemoveText.gameObject.SetActive(false);
            }
            else
            {
                this.freeGearRemoveText.gameObject.SetActive(true);
            }

            if (CustomGearConfirmDialogContent.freeGearRemoveCount > 0)
            {
                // 無料カウントがある場合、beforeCoinはafterCoinTextと同じ
                this.afterCoinText.text = string.Format("{0:#,0}", beforeCoin);
            }
            else
            {
                this.afterCoinText.text = string.Format("{0:#,0}", beforeCoin - beforeGearData.rejectCoin);

                if (beforeCoin - beforeGearData.rejectCoin < 0)
                {
                    this.afterCoinText.color = UIUtility.decreaseColor;
                }
            }

            //外す
            if (afterGearData == null)
            {
                this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearRemove");
                this.yesNo.yes.onClick       = this.CallGearUnsetApi;
                this.freeGearRemoveText.text = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }
            //変更
            else
            {
                this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearChange");
                this.yesNo.yes.onClick       = this.CallGearChageApi;
                this.freeGearRemoveText.text = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }

            //コイン不足・無料回数が0
            if (beforeGearData.rejectCoin > beforeCoin && CustomGearConfirmDialogContent.freeGearRemoveCount <= 0)
            {
                //ボタン押せなくしてグレースケールに
                this.yesNo.yes.button.interactable = false;
                this.yesNo.yes.image.material      = SharedUI.Instance.grayScaleMaterial;
                this.yesNo.yes.text.material       = SharedUI.Instance.grayScaleMaterial;
                this.freeGearRemoveText.text       = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }
        }
    }
예제 #31
0
        private void SaveAssembly()
        {
            AssemblyDefinition ad = TreeViewHandler.GetCurrentAssembly();

            if (ad == null)
            {
                SimpleMessage.ShowInfo("Cannot determine current assembly.");
                return;
            }

            string initDir = null;

            if (!String.IsNullOrEmpty(_lastSaveDir))
            {
                initDir = _lastSaveDir;
            }
            else
            {
                initDir = SourceDir;
            }

            string initFileName = _lastSaveFileName;
            string origFileName = Path.GetFileName(ad.MainModule.FullyQualifiedName);

            if (String.IsNullOrEmpty(initFileName) ||
                !Path.GetFileNameWithoutExtension(initFileName).StartsWith(Path.GetFileNameWithoutExtension(origFileName)))
            {
                initFileName = origFileName;
            }

            string file = SimpleDialog.OpenFile("Save As", Consts.FilterAssemblyFile, Path.GetExtension(initFileName), false, initDir, initFileName);

            if (!String.IsNullOrEmpty(file))
            {
                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                string adPath          = Path.GetDirectoryName(ad.MainModule.FullyQualifiedName);
                bool   resolveDirAdded = Host.AddAssemblyResolveDir(adPath);

                try
                {
                    ad.Write(file);
                }
                finally
                {
                    if (resolveDirAdded)
                    {
                        Host.RemoveAssemblyResolveDir(adPath);
                    }
                }

                _lastSaveDir      = Path.GetDirectoryName(file);
                _lastSaveFileName = Path.GetFileName(file);
                //Config.LastSaveDir = _lastSaveDir;

                SimpleMessage.ShowInfo(String.Format("Assembly saved to {0}", file));

                if (file.Equals(initFileName, StringComparison.OrdinalIgnoreCase))
                {
                    TreeViewHandler.ClearRenamedObjects();
                }
            }
        }