コード例 #1
0
        private void ProcessHandler(Xml.Handler handler)
        {
            if ((handler?.Function ?? String.Empty) == String.Empty)
            {
                return;
            }

            // If a handler is specified, check the script for it first. Note that we don't run both;
            // if you override something like OnDeath, that's your problem.
            VisibleObject invoker;
            VisibleObject invokee;

            if (handler.ScriptSource == Xml.ScriptSource.Target)
            {
                invokee = Target;
                invoker = Source;
            }
            else // Caster
            {
                invokee = Source;
                invoker = Target;
            }

            if (invokee.Script != null)
            {
                invokee.Script.ExecuteFunction(handler.Function, invoker);
                return;
            }

            Type type = invokee.GetType();

            try
            {
                MethodInfo methodInfo = type.GetMethod(handler.Function);
                methodInfo.Invoke(invokee, null);
            }
            catch (Exception e)
            {
                Game.ReportException(e);
                GameLog.Error("Exception processing status handler: {exception}", e);
            }
        }
コード例 #2
0
        public static bool LoadFromFile(string fileName, out Handler obj)
        {
            Exception exception = null;

            return(LoadFromFile(fileName, out obj, out exception));
        }
コード例 #3
0
        public static bool Deserialize(string input, out Handler obj)
        {
            Exception exception = null;

            return(Deserialize(input, out obj, out exception));
        }