/// <summary> /// テストコマンドをドロップダウンしたときに関数リストを更新する /// </summary> private void tolTestCommand_DropDown(object sender, EventArgs e) { //現在のスクリプトの関数リストを生成する this.tolTestCommand.BeginUpdate(); this.tolTestCommand.Items.Clear(); var list = SQ.GetFunctionList(this.FileName); foreach (var item in list) { if (item.Text.Length > 0 && item.Text.Substring(0, 1) == "(") { //無名関数はスキップ continue; } var buf = item.Text + "("; var args = item.Tag as string[]; for (var i = 0; i < args.Length; i++) { buf += "/*" + args[i] + "*/"; if (i < args.Length - 1) { buf += ", "; } } buf += ");"; this.tolTestCommand.Items.Add(buf); } this.tolTestCommand.EndUpdate(); }
/// <summary> /// 【非同期】コード解析を実行します。 /// </summary> private async void doCodeAnalyze() { if (this.uctlOneText.IsDirty && MessageBox.Show(Resources.MsgQ_Confirm.Replace("$", "現在のファイルを保存") + "\r\n保存しない場合は計算できません。", Resources.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } //最新のファイルを読み込むため、解析前に一旦保存する this.uctlOneText.DoSave(); this.ctlSwitchScriptAnalyze(false); //関数探索を実行 var funcFinder = await Task.Run(() => { return(SQ.GetFunctionList(this.uctlOneText.FileName)); }); //変数探索を実行 var valFinder = await Task.Run(() => { return(SQ.GetValueList(this.uctlOneText.FileName)); }); //処理結果を画面に反映 this.ltvScriptFuncList.Items.AddRange(funcFinder.ToArray()); this.ltvScriptValueList.Items.AddRange(valFinder.ToArray()); //System.Media.SystemSounds.Asterisk.Play(); this.ctlSwitchScriptAnalyze(true); }
/// <summary> /// コンストラクター /// </summary> public dlgOrder(AllDB DBList, EffectOrder baseOrder, int frameLength, int targetFrame, bool enabledEditFrameNum, List <string> SQList) { this.InitializeComponent(); this.numTargetFrame.Enabled = enabledEditFrameNum; this.numTargetFrame.Maximum = frameLength - 1; this.DBList = DBList; //効果音リストの生成 Database.CreateComboBoxListFromSrcDB(this.cmbSEList, DBList[Database.DBIndices.Material].DBs[(int)Database.DBMaterialIndices.Sound], false); //独自コマンドの関数リストを生成 this.cmbCommand.Items.Clear(); foreach (var sqFile in SQList) { var funcs = SQ.GetFunctionList(sqFile); foreach (var func in funcs) { this.cmbCommand.Items.Add(func.SubItems[(int)SQ.FuncListColumns.Name].Text); } } this.tips.SetToolTip(this.cmbCommand, $"同一フレームの実行カウンターは {Resources.SQ_EffectSameCounter} です。\r\nこれは特定のフレームが最初に実行されるときだけ処理したい場合などに使います。"); //既定値のセット this.numTargetFrame.Value = (this.numTargetFrame.Maximum >= targetFrame) ? targetFrame : this.numTargetFrame.Maximum; if (baseOrder == null) { return; } if (baseOrder.Frame < frameLength) { //有効なフレーム番号のときだけ既定値からセットする this.numTargetFrame.Value = baseOrder.Frame; } switch (baseOrder.Type) { case EffectOrder.OrderType.Sound: //一致する効果音ファイルを探す for (var i = 0; i < this.cmbSEList.Items.Count; i++) { if (((SoundItem)this.cmbSEList.Items[i]).Value.ToString() == baseOrder.Options[(int)EffectOrder.SoundOptionIndices.FixedID]) { this.cmbSEList.SelectedIndex = i; this.uctlSEEditor.SoundData = new Media.SoundObject( DBList[Database.DBIndices.Material].DBs[(int)Database.DBMaterialIndices.Sound].Rows[i].Cells[(int)Database.DBDefaultColumnIndices.Count].Value?.ToString(), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Volume]), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Pitch]), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Pan]) ); break; } } this.rdbSE.Checked = true; break; case EffectOrder.OrderType.Shake: this.numShakeStrength.Value = int.Parse(baseOrder.Options[0]); this.rdbShake.Checked = true; break; case EffectOrder.OrderType.Flash: this.pnlFlashColor.BackColor = Common.StringToColor(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Color]); this.numFlashStrength.Value = int.Parse(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Strength]); this.numFlashCount.Value = int.Parse(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Count]); this.rdbFlash.Checked = true; break; case EffectOrder.OrderType.WaitBreak: this.rdbWaitBreak.Checked = true; break; case EffectOrder.OrderType.User: this.cmbCommand.Text = baseOrder.Options[0]; this.rdbScript.Checked = true; break; } }