示例#1
0
        static MegaloScriptModelObject CreateForWriteSansId(MegaloScriptModel model, MegaloScriptModelObjectType type)
        {
            switch (type)
            {
            case MegaloScriptModelObjectType.Condition:             return(model.CreateCondition());

            case MegaloScriptModelObjectType.Action:                return(model.CreateAction());

            case MegaloScriptModelObjectType.Trigger:               return(model.CreateTrigger());

            case MegaloScriptModelObjectType.VirtualTrigger: return(model.CreateVirtualTrigger());

            default: throw new KSoft.Debug.UnreachableException(type.ToString());
            }
        }
示例#2
0
        /// <summary>Create the identiy of an existing object based on an its handle</summary>
        /// <param name="model"></param>
        /// <param name="handle"></param>
        /// <returns></returns>
        /// <remarks>Not all object types support this operation</remarks>
        static MegaloScriptModelObject Recreate(MegaloScriptModel model, MegaloScriptModelObjectHandle handle)
        {
            int id = handle.Id;

            switch (handle.Type)
            {
            case MegaloScriptModelObjectType.Condition:             return(model.CreateCondition(id));

            case MegaloScriptModelObjectType.Action:                return(model.CreateAction(id));

            case MegaloScriptModelObjectType.Trigger:               return(model.CreateTrigger(id));

            case MegaloScriptModelObjectType.VirtualTrigger: return(model.CreateVirtualTrigger(id));

            default: throw new KSoft.Debug.UnreachableException(handle.Type.ToString());
            }
        }