private void btnObjectUpdate_Click(object sender, RoutedEventArgs e) { int row = lsvObjectList.SelectedIndex; if (row >= 0) { if (SystemOperator.IsNumeric(txbObjSizeX.Text) && SystemOperator.IsNumeric(txbObjSizeY.Text) && SystemOperator.IsNumeric(txbObjTargetID.Text) && SystemOperator.IsNumeric(txbObjectTalkID.Text)) { if (rdbZindexBack.IsChecked == true) { stageEditorData.objectZindex[row] = 5; } else { stageEditorData.objectZindex[row] = 11; } stageEditorData.objectSize[row] = new Vector(int.Parse(txbObjSizeX.Text), int.Parse(txbObjSizeY.Text)); stageEditorData.objectTargetType[row] = (TargetType)Enum.Parse(typeof(TargetType), cmbObjectTargetType.SelectedItem.ToString()); stageEditorData.objectTargetId[row] = int.Parse(txbObjTargetID.Text); stageEditorData.objectToggleSwitch[row] = (bool)ckbObjToggleSwitch.IsChecked; stageEditorData.objectTalkID[row] = int.Parse(txbObjectTalkID.Text); ListViewObjectDataUpdate(); } else { MessageBox.Show("値は数字のみ有効です。半角数字を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information); } } }
private void OptionDataUpdate(int row) { switch (cmbEventType.SelectedItem) { case "Wait": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "Balloon": if (SystemOperator.IsNumeric(txbOptBalloonX.Text) && SystemOperator.IsNumeric(txbOptBalloonY.Text) && SystemOperator.IsNumeric(txbOptTargetId.Text)) { propertyEventData[row].balloonPos = new Vector(int.Parse(txbOptBalloonX.Text), int.Parse(txbOptBalloonY.Text)); propertyEventData[row].balloonMsg = txbOptMessage.Text; propertyEventData[row].balloonEnterClose = (bool)ckbOptEnterClose.IsChecked; propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "BgmPlay": propertyEventData[row].bgmName = (BgmName)Enum.Parse(typeof(BgmName), cmbOptBgmName.SelectedItem.ToString()); break; case "SePlay": propertyEventData[row].seName = (SeName)Enum.Parse(typeof(SeName), cmbOptSeName.SelectedItem.ToString()); break; case "Move": if (SystemOperator.IsNumeric(txbOptTargetId.Text) && SystemOperator.IsNumeric(txbOptSpeed.Text)) { propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); propertyEventData[row].moveDistance = new Vector(int.Parse(txbOptDistanceX.Text), int.Parse(txbOptDistanceY.Text)); propertyEventData[row].moveSpeed = int.Parse(txbOptSpeed.Text); propertyEventData[row].direction = (bool)ckbOptDirection.IsChecked; } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "KeyLock": propertyEventData[row].flagKeyLock = (bool)ckbOptKeyLock.IsChecked; break; case "UiVisibility": propertyEventData[row].uiVisible = (bool)ckbOptUiVisibility.IsChecked; break; case "CharaFadeIn": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "CharaImageChange": if (SystemOperator.IsNumeric(txbOptTargetId.Text)) { propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); propertyEventData[row].categoryName = (CategoryName)Enum.Parse(typeof(CategoryName), cmbOptCategoryName.SelectedItem.ToString()); propertyEventData[row].patternName = cmbOptPatternName.SelectedItem.ToString(); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "ScreenFadeIn": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].fadeType = (bool)ckbOptFadeType.IsChecked; propertyEventData[row].color = (ColorEnum)Enum.Parse(typeof(ColorEnum), cmbOptColor.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "ScreenFadeOut": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].fadeType = (bool)ckbOptFadeType.IsChecked; propertyEventData[row].color = (ColorEnum)Enum.Parse(typeof(ColorEnum), cmbOptColor.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "GenerateEnemy": if (SystemOperator.IsNumeric(txbOptStartX.Text) && SystemOperator.IsNumeric(txbOptStartY.Text)) { propertyEventData[row].setPosition = new Vector(int.Parse(txbOptStartX.Text), int.Parse(txbOptStartY.Text)); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "EventEnd": propertyEventData[row].eventOnly = (bool)ckbOptEventOnly.IsChecked; break; } }