public static Command Create(Sugarism.Command.Type cmdType) { if (Sugarism.Command.Type.MAX == cmdType) { return(null); } switch (cmdType) { case Sugarism.Command.Type.Lines: return(Create(new Sugarism.CmdLines(ScenarioEditor.Model.Character.START_ID))); case Sugarism.Command.Type.Text: return(Create(new Sugarism.CmdText(string.Empty))); case Sugarism.Command.Type.Appear: return(Create(new Sugarism.CmdAppear(ScenarioEditor.Model.Character.START_ID))); case Sugarism.Command.Type.Background: return(Create(new Sugarism.CmdBackground(Sugarism.CmdBackground.START_ID))); case Sugarism.Command.Type.MiniPicture: return(Create(new Sugarism.CmdMiniPicture(Sugarism.CmdMiniPicture.START_ID))); case Sugarism.Command.Type.Picture: return(Create(new Sugarism.CmdPicture(Sugarism.CmdPicture.START_ID))); case Sugarism.Command.Type.Filter: return(Create(new Sugarism.CmdFilter())); case Sugarism.Command.Type.SE: return(Create(new Sugarism.CmdSE(Sugarism.CmdSE.START_ID))); case Sugarism.Command.Type.Feeling: return(Create(new Sugarism.CmdFeeling(ScenarioEditor.Model.Character.START_ID))); case Sugarism.Command.Type.Switch: return(Create(new Sugarism.CmdSwitch(ScenarioEditor.Model.Character.START_ID))); // case Sugarism.Command.Type.Case: // prohibit user from adding it. case Sugarism.Command.Type.TargetAppear: return(Create(new Sugarism.CmdTargetAppear(ScenarioEditor.Model.Target.START_ID))); case Sugarism.Command.Type.Disappear: return(Create(new Sugarism.CmdDisappear())); default: return(null); } }
private Command create() { if (SelectedIndex < 0) { return(null); } if (SelectedIndex >= CmdTypeList.Count) { return(null); } Sugarism.Command.Type selectedCmdType = CmdTypeList[SelectedIndex]; return(Command.Create(selectedCmdType)); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((null == value) || (false == (value is Sugarism.Command.Type))) { return(string.Empty); } Sugarism.Command.Type cmdType = (Sugarism.Command.Type)value; string strCmdType = cmdType.ToString(); int intCmdType = System.Convert.ToInt32(cmdType); string s = string.Format("{0}:{1}", intCmdType, strCmdType); return(s); }