private void ToolStripMenuItem_Add_Click(object sender, EventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo(); if (clElem == null) { return; } //以下、オプション追加処理 ToolStripMenuItem clITem = sender as ToolStripMenuItem; EnmTypeOption enTypeOption = (EnmTypeOption)clITem.Tag; object clValue1 = ClsParam.GetDefaultValue1(enTypeOption); object clValue2 = ClsParam.GetDefaultValue2(enTypeOption); clElem.SetOption(enTypeOption, false, false, null, null, clValue1, clValue2); //以下、行番号振り直し処理 clMotion.RefreshLineNo(); //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
/// <summary> /// 現在選択中のアイテムを削除する /// </summary> private void RemoveItemFromSelectLineNo() { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } int inLineNo = ClsSystem.GetSelectLineNo(); if (inLineNo < 0) { return; } //以下、アイテム削除処理 clMotion.RemoveItemFromLineNo(inLineNo, false, true); //以下、行番号振り直し処理 clMotion.RefreshLineNo(); //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void panel_Control_MouseUp(object sender, MouseEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } //以下、エレメントをドロップする処理 if (e.Button == MouseButtons.Left) { if (this.mFormDragLabel != null) { if (!this.mFormDragLabel.IsDisposed) { bool isHit = false; //以下、子供として登録する処理 ClsDatElem clElemBase = clMotion.FindElemFromMark(EnmMarkElement.IN); if (clElemBase != null) { ClsDatElem clElem = this.mFormDragLabel.GetElem(); clElemBase.AddElemChild(clElem); isHit = true; } //以下、自分の兄として登録する処理 clElemBase = clMotion.FindElemFromMark(EnmMarkElement.UP); if (clElemBase != null) { ClsDatElem clElem = this.mFormDragLabel.GetElem(); clElemBase.AddElemBigBrother(clElem); isHit = true; } //以下、行番号割り振り処理 if (isHit) { clMotion.RefreshLineNo(); } } this.mFormDragLabel.Close(); this.mFormDragLabel.Dispose(); this.mFormDragLabel = null; } //以下、マークをクリアする処理 clMotion.ClearInsertMark(); //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); } }
private void panel_Control_MouseDown(object sender, MouseEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } //以下、テキストボックス削除処理 this.RemoveTextBoxName(); //以下、アイテム選択処理 int inLineNo = this.GetLineNoFromPositionY(e.Y); ClsSystem.SetSelectFromLineNo(inLineNo); if (e.Button == MouseButtons.Left) { //以下、掴んでいるエレメントを別ウィンドウで表示する処理 ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo); if (clItem != null && clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM) { int inX = Cursor.Position.X; int inY = Cursor.Position.Y; this.mCatchPosStart = new Point(inX, inY); } } //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void FormControl_Load(object sender, EventArgs e) { //以下、ウィンドウの設定 this.Location = ClsSystem.mSetting.mWindowControl.mLocation; this.Size = ClsSystem.mSetting.mWindowControl.mSize; //以下、初期化処理 ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion != null) { int inFrameNum = (int)this.numericUpDown_MaxFrame.Value; clMotion.SetMaxFrameNum(inFrameNum); } this.mFont = new Font("MS ゴシック", 10.5f); this.panel_Time.Width = CELL_WIDTH * (int)numericUpDown_MaxFrame.Value; this.panel_Time.Height = HEAD_HEIGHT * 5; this.ToolStripMenuItem_AddRotation.Tag = EnmTypeOption.ROTATION; this.ToolStripMenuItem_AddScale.Tag = EnmTypeOption.SCALE; this.ToolStripMenuItem_AddOffset.Tag = EnmTypeOption.OFFSET; this.ToolStripMenuItem_AddFlip.Tag = EnmTypeOption.FLIP; this.ToolStripMenuItem_AddTransparency.Tag = EnmTypeOption.TRANSPARENCY; this.ToolStripMenuItem_AddColor.Tag = EnmTypeOption.COLOR; this.ToolStripMenuItem_AddUserDataText.Tag = EnmTypeOption.USER_DATA; }
private void panel_Control_MouseClick(object sender, MouseEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } //以下、アイテム選択処理 int inLineNo = this.GetLineNoFromPositionY(e.Y); ClsSystem.SetSelectFromLineNo(inLineNo); ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo); if (clElem != null) { if (inLineNo == clElem.mLineNo) { //Click Eye if (0 <= e.X && e.X < 17) { clElem.isDisplay = !clElem.isDisplay; } //Click Parent if (17 <= e.X && e.X < 34) { if (clElem.mElem != null) { clElem.isParent = !clElem.isParent; } } //Click Locked if (34 <= e.X && e.X < 51) { clElem.isLocked = !clElem.isLocked; } //Attribute Open if (51 <= e.X && e.X < 68) { clElem.isOpen = !clElem.isOpen; clMotion.RefreshLineNo(); //行番号とタブを割り振る処理 } } } //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
/// <summary> /// オプションの情報を修正する処理 /// </summary> /// <param name="clParam">パラメーター情報</param> public void ChangeElemFromParam(ClsParam clParam) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo(); if (clElem == null) { return; } int inSelectFrameNo = ClsSystem.GetSelectFrameNo(); //以下、表示設定 object clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.DISPLAY); this.ChangeElem(clElem, EnmTypeOption.DISPLAY, inSelectFrameNo, clParam.mDisplayKeyFrame, false, false, null, null, clParam.mDisplay, clValue2); //以下、座標設定 this.ChangeElem(clElem, EnmTypeOption.POSITION, inSelectFrameNo, clParam.mPositionKeyFrame, clParam.mPositionXTween, clParam.mPositionYTween, clParam.mTweenPositionX, clParam.mTweenPositionY, clParam.mX, clParam.mY); //以下、回転設定 clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.ROTATION); this.ChangeElem(clElem, EnmTypeOption.ROTATION, inSelectFrameNo, clParam.mRotationKeyFrame, clParam.mRotationTween, false, clParam.mTweenRotation, null, clParam.mRZ, clValue2); //以下、スケール設定 this.ChangeElem(clElem, EnmTypeOption.SCALE, inSelectFrameNo, clParam.mScaleKeyFrame, clParam.mScaleXTween, clParam.mScaleYTween, clParam.mTweenScaleX, clParam.mTweenScaleY, clParam.mSX, clParam.mSY); //以下、オフセット設定 this.ChangeElem(clElem, EnmTypeOption.OFFSET, inSelectFrameNo, clParam.mOffsetKeyFrame, clParam.mOffsetXTween, clParam.mOffsetYTween, clParam.mTweenOffsetX, clParam.mTweenOffsetY, clParam.mCX, clParam.mCY); //以下、反転設定 this.ChangeElem(clElem, EnmTypeOption.FLIP, inSelectFrameNo, clParam.mFlipKeyFrame, false, false, null, null, clParam.mFlipH, clParam.mFlipV); //以下、透明設定 clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.TRANSPARENCY); this.ChangeElem(clElem, EnmTypeOption.TRANSPARENCY, inSelectFrameNo, clParam.mTransKeyFrame, clParam.mTransTween, false, clParam.mTweenTrans, null, clParam.mTrans, clValue2); //以下、カラー設定 clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.COLOR); this.ChangeElem(clElem, EnmTypeOption.COLOR, inSelectFrameNo, clParam.mColorKeyFrame, clParam.mColorTween, false, clParam.mTweenColor, null, clParam.mColor, clValue2); //以下、ユーザーデータ設定 clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.USER_DATA); this.ChangeElem(clElem, EnmTypeOption.USER_DATA, inSelectFrameNo, clParam.mUserDataKeyFrame, false, false, null, null, clParam.mUserData, clValue2); //以下、行番号を振り直す処理 clMotion.RefreshLineNo(); //以下、メインウィンドウ更新処理 this.mFormMain.RefreshAll(); }
/// <summary> /// モーション全削除処理 /// </summary> public static void RemoveAllMotion() { //以下、モーションクリア処理 foreach (int inKey in ClsSystem.mDicMotion.Keys) { ClsDatMotion clDatMotion = ClsSystem.mDicMotion[inKey]; clDatMotion.Remove(); } ClsSystem.mDicMotion.Clear(); }
/// <summary> /// 行番号割り振り処理 /// </summary> /// <param name="clMotion">モーション管理クラス</param> public void RefreshLineNo(ClsDatMotion clMotion) { //以下、表示しなくてはいけない種別かどうかチェックする処理 bool isDraw = ClsDatOption.IsDraw(this.mTypeOption); if (isDraw) { //以下、行番号設定 this.mLineNo = clMotion.mWorkLineNo; clMotion.mWorkLineNo++; } }
private void panel_Time_Paint(object sender, PaintEventArgs e) { //以下、モーションのコントロール描画処理 ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion != null) { int inSelectFrameNo = (int)this.numericUpDown_NowFlame.Value; ClsSystem.SetSelectFrameNo(inSelectFrameNo); clMotion.DrawTime(e.Graphics, this.panel_Time.Width, this.panel_Time.Height); } }
private void panel_Control_Paint(object sender, PaintEventArgs e) { int inWidth = this.panel_Control.Width; int inHeight = this.panel_Control.Height; //以下、モーションのコントロール描画処理 ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion != null) { clMotion.DrawControl(e.Graphics, this.panel_Control.Width, this.panel_Control.Height, this.mFont); } }
/// <summary> /// ウィンドウ名取得処理 /// </summary> /// <param name="clWindowName">ウィンドウ名</param> /// <param name="clMotion">モーション管理クラス</param> /// <returns>ウィンドウ名</returns> public static string GetWindowName(string clWindowName, ClsDatMotion clMotion) { string clName = ""; if (clMotion != null) { clName = " ( " + clMotion.mName + " )"; } string clResultName = clWindowName + clName; return(clResultName); }
public void RemoveElementFromKey(int inElementKey) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } clMotion.RemoveElemFromIndex(inElementKey); this.RefreshAll(); }
private void button_ItemDown_Click(object sender, EventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } int inLineNo = ClsSystem.GetSelectLineNo(); if (inLineNo < 0) { return; } ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo); if (clItem == null) { return; } if (clItem.mTypeItem != ClsDatItem.TYPE_ITEM.ELEM) { return; } //以下、一つ下に移動する処理 ClsDatElem clElem = clItem as ClsDatElem; if (clElem.mElem == null) { clMotion.MoveDown(clElem); } else { clElem.mElem.MoveElemDown(clElem); } //以下、行番号振り直し処理 clMotion.RefreshLineNo(); //以下、改めてアイテムを選択する処理 ClsSystem.SetSelectFromLineNo(clItem.mLineNo); //上記の RefreshLineNo 関数内でmLineNoが変わっているはず //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
/// <summary> /// モーション削除処理 /// </summary> /// <param name="inKey">モーションキー</param> public static void RemoveMotion(int inKey) { bool isExist = ClsSystem.mDicMotion.ContainsKey(inKey); if (!isExist) { return; } ClsDatMotion clMotion = ClsSystem.mDicMotion[inKey]; clMotion.Remove(); ClsSystem.mDicMotion.Remove(inKey); }
private void panel_Control_MouseDoubleClick(object sender, MouseEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } //Item選択 int inLineNo = this.GetLineNoFromPositionY(e.Y); //以下、エレメント選択処理 ClsSystem.SetSelectFromLineNo(inLineNo); //Item最大数を確認 ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo); if (clElem != null) { if (e.X > 69) { //以下、テキストボックス削除処理 this.RemoveTextBoxName(); //以下、テキストボックス生成処理 this.mTextBox = new TextBox(); this.mTextBox.Location = new System.Drawing.Point(69, inLineNo * FormControl.CELL_HEIGHT - 1); this.mTextBox.Font = new System.Drawing.Font("MS ゴシック", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); this.mTextBox.MaxLength = ClsDatElem.MAX_NAME; this.mTextBox.Text = clElem.GetName(); this.mTextBox.Name = "textBox_Name"; this.mTextBox.Size = new System.Drawing.Size(80, 19); this.mTextBox.Tag = inLineNo; this.mTextBox.TabIndex = 0; this.mTextBox.Leave += new System.EventHandler(this.textBox_Name_Leave); this.mTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_Name_KeyDown); this.panel_Control.Controls.Add(this.mTextBox); this.mTextBox.Focus(); } } //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void panel_Time_MouseDown(object sender, MouseEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } int inFrameNo = this.GetFrameNoFromPositionX(e.X); int inLineNo = this.GetLineNoFromPositionY(e.Y); //以下、現在位置を設定する処理 ClsSystem.SetSelectFromLineNo(inLineNo); ClsSystem.SetSelectFrameNo(inFrameNo); //以下、フレーム選択処理 if (inFrameNo <= this.numericUpDown_MaxFrame.Value) { this.numericUpDown_NowFlame.Value = inFrameNo; } else { this.numericUpDown_NowFlame.Value = this.numericUpDown_MaxFrame.Value - 1; } /* 一旦コメントアウト 2017/01/31 comment out by yoshi * if (e.Button == MouseButtons.Left) * { * //以下、座標情報初期化処理 * mMouseDownL = true; * mSelect_Pos_End.X = 0; * mSelect_Pos_End.Y = 0; * } */ /* 一旦コメントアウト 2017/01/31 comment out by yoshi * //if (e.Button == MouseButtons.Right) { mMouseDownR = true; } * //if (e.Button == MouseButtons.Middle) { mMouseDownM = true; } * mSelect_Pos_Start.X = e.X / FormControl.CELL_WIDTH; * mSelect_Pos_Start.Y = e.Y / FormControl.CELL_HEIGHT; */ //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void MaxFrame_ValueChanged(object sender, EventArgs e) { int inFrameNum = (int)this.numericUpDown_MaxFrame.Value; ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion != null) { clMotion.SetMaxFrameNum(inFrameNum); } int inWidth = inFrameNum * FormControl.CELL_WIDTH + 1; this.panel_Time.Width = inWidth; this.panel_Time.Refresh(); }
/// <summary> /// 行番号からアイテムを取得する /// </summary> /// <param name="inLineNo">行番号</param> /// <returns>行番号のアイテム</returns> public static ClsDatItem GetItemFromLineNo(int inLineNo) { if (inLineNo < 0) { return(null); } ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return(null); } ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo); return(clItem); }
/// <summary> /// モーション取得処理 /// </summary> /// <param name="inKey">モーションキー</param> /// <returns>モーション管理クラス</returns> public static ClsDatMotion GetMotion(int inKey) { if (ClsSystem.mDicMotion == null) { return(null); } bool isExist = ClsSystem.mDicMotion.ContainsKey(inKey); if (!isExist) { return(null); } ClsDatMotion clMotion = ClsSystem.mDicMotion[inKey]; return(clMotion); }
/// <summary> /// 保存処理 /// </summary> /// <param name="clFilePath">ファイルパス</param> public static void Save(string clFilePath) { ClsSystem.mFileBuffer = new StringBuilder(); //以下、プロジェクトファイル保存処理 string clLine = "?xml version=\"1.0\" encoding=\"utf-8\"?"; ClsTool.AppendElementStart("", clLine); clLine = "HanimProjectData xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; ClsTool.AppendElementStart("", clLine); string clHeader = ClsSystem.FILE_TAG; string clHeaderName = "hap"; ClsTool.AppendElement(clHeader, "Header", clHeaderName); int inVersion = 1; ClsTool.AppendElement(clHeader, "Ver", inVersion); //以下、イメージリスト保存処理 foreach (int inKey in ClsSystem.mDicImage.Keys) { ClsDatImage clDatImage = ClsSystem.mDicImage[inKey]; clDatImage.Save(clHeader); } //以下、モーションリスト保存処理 foreach (int inKey in ClsSystem.mDicMotion.Keys) { ClsDatMotion clDatMotion = ClsSystem.mDicMotion[inKey]; clDatMotion.Save(clHeader); } ClsTool.AppendElementEnd("", "HanimProjectData"); //以下、プロジェクトファイル保存処理 string clBuffer = ClsSystem.mFileBuffer.ToString(); File.WriteAllText(clFilePath, clBuffer, Encoding.UTF8); }
private void ToolStripMenuItem_AddKeyFrame_Click(object sender, EventArgs e) { int inIndex = (int)this.numericUpDown_NowFlame.Value; if (inIndex <= 0) { return; //0フレーム目には作成できない } ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } ClsDatOption clOption = ClsSystem.GetOptionFromSelectLineNo(); if (clOption == null) { return; } //以下、キーフレーム作成・更新処理 ClsDatElem clElem = clOption.mElemParent; bool isParentFlag = ClsParam.GetDefaultParentFlag(clElem.mElem, clOption.mTypeOption); //以下、現在の値を取得する処理 object clValue1 = clOption.GetValue1(inIndex); object clValue2 = clOption.GetValue2(inIndex); ClsDatKeyFrame clKeyFrame = new ClsDatKeyFrame(clOption.mTypeOption, inIndex, false, false, null, null, clValue1, clValue2); clOption.SetKeyFrame(inIndex, false, false, null, null, clValue1, clValue2); //存在していたら更新、存在していなかったら追加 //以下、コントロール更新処理 this.RefreshControl(); this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void contextMenuStrip_Opening(object sender, CancelEventArgs e) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } bool isRemoveElementEnable = false; bool isAddOptionEnable = false; bool isRemoveOptionEnable = false; int inLineNo = ClsSystem.GetSelectLineNo(); if (inLineNo >= 0) { ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo); if (clItem != null) { isRemoveElementEnable = true; isAddOptionEnable = true; } ClsDatOption clOption = ClsSystem.GetOptionFromLineNo(inLineNo); if (clOption != null) { bool isRemoveOK = clOption.IsRemoveOK(); if (isRemoveOK) { isRemoveOptionEnable = true; } } } this.ToolStripMenuItem_RemoveElement.Enabled = isRemoveElementEnable; this.ToolStripMenuItem_AddOption.Enabled = isAddOptionEnable; this.ToolStripMenuItem_RemoveOption.Enabled = isRemoveOptionEnable; }
private void RemoveTextBoxName() { if (this.mTextBox == null) { return; } ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } //以下、名前設定処理 int inLineNo = (int)this.mTextBox.Tag; ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo); if (clElem != null) { string clName = this.mTextBox.Text; if (!string.IsNullOrEmpty(clName)) { clElem.SetName(clName); } } //以下、テキストボックス削除処理 this.panel_Control.Controls.Remove(this.mTextBox); this.mTextBox = null; //以下、コントロール更新処理 this.panel_Control.Refresh(); this.panel_Time.Refresh(); this.mFormMain.Refresh(); }
private void RefreshControl() { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { return; } int inSelectFrameNo = ClsSystem.GetSelectFrameNo(); int inMaxFrameNum = clMotion.GetMaxFrameNum(); int inSelectLineNo = ClsSystem.GetSelectLineNo(); ClsDatItem clItem = clMotion.GetItemFromLineNo(inSelectLineNo); //以下、削除ボタン有効化設定 bool isEnable = false; if (clItem != null) { if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM) { isEnable = true; } else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION) { ClsDatOption clOption = clItem as ClsDatOption; isEnable = clOption.IsRemoveOK(); } } this.button_ItemRemove.Enabled = isEnable; //以下、アトリビュートウィンドウ設定 if (this.mFormMain != null) { if (this.mFormMain.mFormAttribute != null) { ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo(); this.mFormMain.mFormAttribute.Init(clElem, inSelectFrameNo, inMaxFrameNum); } } //以下、上ボタン有効化設定 isEnable = false; if (clItem != null) { ClsDatElem clElem = null; if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM) { clElem = clItem as ClsDatElem; if (clElem.mElem == null) { isEnable = clMotion.CanMoveUp(clElem); } else { //isEnable = clElem.mElem.CanMoveUp(clElem); //自分が長男かチェックする } } /* * else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION) * { * ClsDatOption clOption = clItem as ClsDatOption; * clElem = clOption.mElem; * // isEnable = clElem.CanMoveUp(clOption); * } */ } this.button_ItemUp.Enabled = isEnable; //以下、下ボタン有効化設定 isEnable = false; if (clItem != null) { ClsDatElem clElem = null; if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM) { clElem = clItem as ClsDatElem; if (clElem.mElem == null) { isEnable = clMotion.CanMoveDown(clElem); } else { } } /* * else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION) * { * ClsDatOption clOption = clItem as ClsDatOption; * clElem = clOption.mElem; * // isEnable = clElem.CanMoveDown(clOption); * } */ } this.button_ItemDown.Enabled = isEnable; }
/// <summary> /// 指定フレームの値2を取得する処理 /// </summary> /// <param name="inFrameNo">フレームNo</param> /// <returns>値2</returns> public object GetValue2(int inFrameNo) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { goto RETURN_DEFAULT2; } int inMaxFrameNum = clMotion.GetMaxFrameNum(); int inFrameNoBefore = 0; int inFrameNoAfter = 0; this.GetKeyFrameNo(inFrameNo, inMaxFrameNum, out inFrameNoBefore, out inFrameNoAfter); //以下、キーフレーム存在チェック bool isExist = this.mDicKeyFrame.ContainsKey(inFrameNoBefore); if (!isExist) { goto RETURN_DEFAULT2; } isExist = this.mDicKeyFrame.ContainsKey(inFrameNoAfter); if (!isExist) { goto RETURN_DEFAULT2; } //以下、キーフレーム取得処理 ClsDatKeyFrame clKeyFrameBefore = this.mDicKeyFrame[inFrameNoBefore]; if (clKeyFrameBefore == null) { goto RETURN_DEFAULT2; } if (clKeyFrameBefore.mTween2 == null) { object clValueTmp = clKeyFrameBefore.mValue2; return(clValueTmp); } ClsDatKeyFrame clKeyFrameAfter = this.mDicKeyFrame[inFrameNoAfter]; if (clKeyFrameAfter == null) { goto RETURN_DEFAULT2; } //以下、キーフレームの値取得処理 object clValueBefore = clKeyFrameBefore.mValue2; if (clValueBefore == null) { goto RETURN_DEFAULT2; } if (clValueBefore is bool && clValueBefore is string) { return(clValueBefore); } object clValueAfter = clKeyFrameAfter.mValue2; if (clValueAfter == null) { goto RETURN_DEFAULT2; } if (clValueAfter is bool && clValueAfter is string) { goto RETURN_DEFAULT2; } //以下、現在フレームの値(トゥイーン込みの)計算処理 if (clValueBefore is int && clValueAfter is int) { //Tweenを見て値を分割する処理 } else if (clValueBefore is float && clValueAfter is float) { //Tweenを見て値を分割する処理 } RETURN_DEFAULT2: object clValue = ClsParam.GetDefaultValue2(this.mTypeOption); return(clValue); }
/// <summary> /// 指定フレームの値1を取得する処理 /// </summary> /// <param name="inFrameNo">フレームNo</param> /// <returns>値1</returns> public object GetValue1(int inFrameNo) { ClsDatMotion clMotion = ClsSystem.GetSelectMotion(); if (clMotion == null) { goto RETURN_DEFAULT1; } int inMaxFrameNum = clMotion.GetMaxFrameNum(); int inFrameNoBefore = 0; int inFrameNoAfter = 0; this.GetKeyFrameNo(inFrameNo, inMaxFrameNum, out inFrameNoBefore, out inFrameNoAfter); ClsDatKeyFrame clKeyFrameBefore = this.mDicKeyFrame[inFrameNoBefore]; if (clKeyFrameBefore == null) { goto RETURN_DEFAULT1; } if (clKeyFrameBefore.mTween1 == null) { object clValueTmp = clKeyFrameBefore.mValue1; return(clValueTmp); } bool isExist = this.mDicKeyFrame.ContainsKey(inFrameNoAfter); if (!isExist) { goto RETURN_DEFAULT1; } ClsDatKeyFrame clKeyFrameAfter = this.mDicKeyFrame[inFrameNoAfter]; if (clKeyFrameAfter == null) { goto RETURN_DEFAULT1; } object clValueBefore = clKeyFrameBefore.mValue1; if (clValueBefore == null) { goto RETURN_DEFAULT1; } if (clValueBefore is bool && clValueBefore is string) { return(clValueBefore); } object clValueAfter = clKeyFrameAfter.mValue1; if (clValueAfter == null) { goto RETURN_DEFAULT1; } if (clValueAfter is bool && clValueAfter is string) { goto RETURN_DEFAULT1; } //以下、現在フレームの値(トゥイーン込みの)計算処理 if (clValueBefore is int && clValueAfter is int) { //Tweenを見て値を分割する処理 //clKeyFrameBefore.mTween1.GetRate //←中でその場で256の重みリストを作成してない? //もしそうなら、そのリストをメンバ内に保持するようにする } else if (clValueBefore is float && clValueAfter is float) { //Tweenを見て値を分割する処理 //clKeyFrameBefore.mTween1.GetRate //←中でその場で256の重みリストを作成してない? //もしそうなら、そのリストをメンバ内に保持するようにする } RETURN_DEFAULT1: object clValue = ClsParam.GetDefaultValue1(this.mTypeOption); return(clValue); }
/// <summary> /// 読み込み処理 /// </summary> /// <param name="clListView">モーションリストビュー</param> /// <param name="clFilePath">ファイルパス</param> public static void Load(ListView clListView, string clFilePath) { ClsSystem.mMotionSelectKey = -1; XmlDocument clXmlDoc = new XmlDocument(); try { //以下、xmlファイル読み込み処理 clXmlDoc.Load(clFilePath); //以下、プロジェクトファイル読み込み処理 IEnumerator iEnum = clXmlDoc.DocumentElement.GetEnumerator(); while (iEnum.MoveNext()) { XmlElement clXmlElem = iEnum.Current as XmlElement; if ("Header".Equals(clXmlElem.Name)) { if (!"hap".Equals(clXmlElem.InnerText)) { throw new Exception("this is not hanim project file."); } ClsSystem.mHeader = clXmlElem.InnerText; continue; } if ("Ver".Equals(clXmlElem.Name)) { Match clMatch = Regex.Match(clXmlElem.InnerText, "^\\d+$"); if (!clMatch.Success) { throw new Exception("this is not allowed version."); } ClsSystem.mVer = Convert.ToInt32(clXmlElem.InnerText); continue; } if ("Image".Equals(clXmlElem.Name)) { ClsDatImage clDatImage = new ClsDatImage(); clDatImage.Load(clXmlElem); ClsSystem.mDicImage.Add(clDatImage.mID, clDatImage); continue; } if ("Motion".Equals(clXmlElem.Name)) { ClsDatMotion clDatMotion = new ClsDatMotion(0, ""); clDatMotion.Load(clXmlElem); ListViewItem clListViewItem = new ListViewItem(clDatMotion.mName, 2); clListView.Items.Add(clListViewItem); clListViewItem.Tag = ClsSystem.mDicMotion.Count; clDatMotion.mItemHashCode = clListViewItem.GetHashCode(); clDatMotion.Restore(); //モーションの親子関連付け再構築処理 clDatMotion.RefreshLineNo(); //行番号などを設定する処理 ClsSystem.mDicMotion.Add(clDatMotion.mID, clDatMotion); continue; } throw new Exception("this is abnormality format."); } //以下、デフォルトで選択しているモーションを設定する処理 if (clListView.Items.Count >= 1) { ClsSystem.mMotionSelectKey = clListView.Items[0].GetHashCode(); } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 現在選択中のモーションを取得する /// </summary> /// <returns>現在選択中のモーション</returns> public static ClsDatMotion GetSelectMotion() { ClsDatMotion clMotion = ClsSystem.GetMotion(ClsSystem.mMotionSelectKey); return(clMotion); }
/// <summary> /// モーション追加処理 /// </summary> /// <param name="inKey">モーションキー</param> /// <param name="clMotion">モーション管理クラス</param> public static void AddMotion(int inKey, ClsDatMotion clMotion) { ClsSystem.mDicMotion[inKey] = clMotion; }