Exemplo n.º 1
0
        public override void OnGetValue(LocationInterceptionArgs args)
        {
            base.OnGetValue(args);

            if (DefaultProvider != null && !_defaultProviderSet)
            {
                _defaultProvider    = (TypedValueProvider)Activator.CreateInstance(DefaultProvider);
                _defaultProviderSet = true;
            }
            if (Get)
            {
                if (ConvertType == null)
                {
                    ConvertType = args.Location.LocationType;
                }
                try
                {
                    args.Value = Json ? JsonConvert.DeserializeObject(FlashUtil.Call(Name), ConvertType) : FlashUtil.Call(Name, ConvertType);
                }
                catch
                {
                    args.Value = _defaultProvider.Provide(ConvertType);
                }
            }
        }
Exemplo n.º 2
0
        public override void OnInvoke(MethodInterceptionArgs args)
        {
            if (RunMethodPre)
            {
                args.Proceed();
            }

            if (DefaultProvider != null && !_defaultProviderSet)
            {
                _defaultProvider    = (TypedValueProvider)Activator.CreateInstance(DefaultProvider);
                _defaultProviderSet = true;
            }

            if (GameFunction)
            {
                try
                {
                    args.ReturnValue = JsonConvert.DeserializeObject(ScriptInterface.Instance.CallGameFunction(Name, args.Arguments.ToArray()), (args.Method as MethodInfo).ReturnType);
                }
                catch
                {
                    args.ReturnValue = DefaultValue ?? _defaultProvider.Provide((args.Method as MethodInfo).ReturnType);
                }
            }
            else
            {
                args.ReturnValue = FlashUtil.Call(Name, (args.Method as MethodInfo).ReturnType, args.Arguments.ToArray());
            }
            if (RunMethodPost && !RunMethodPre)
            {
                args.Proceed();
            }
        }
Exemplo n.º 3
0
        public string Call()
        {
            string result = FlashUtil.Call("fcCall", _fobj.ID);

            if (DestroyOnCall)
            {
                Destroy();
            }
            return(result);
        }
Exemplo n.º 4
0
        public FlashObject <T> CallFlash <T>()
        {
            FlashObject <T> obj = new FlashObject <T>(FlashUtil.Call <int>("fcCallFlash", _fobj.ID));

            if (DestroyOnCall)
            {
                Destroy();
            }
            return(obj);
        }
Exemplo n.º 5
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     base.OnSetValue(args);
     if (Set)
     {
         foreach (string name in Names)
         {
             FlashUtil.Call("setGameObject", name, args.Value);
         }
     }
 }
Exemplo n.º 6
0
        public override void OnGetValue(LocationInterceptionArgs args)
        {
            if (DefaultProvider != null && !_defaultProviderSet)
            {
                _defaultProvider    = (TypedValueProvider)Activator.CreateInstance(DefaultProvider);
                _defaultProviderSet = true;
            }

            if (Get)
            {
                if (RequireNotNull != null && ScriptInterface.Instance.IsNull(RequireNotNull))
                {
                    args.Value = DefaultValue ?? _defaultProvider.Provide(ConvertType);
                }
                else
                {
                    try
                    {
                        if (ConvertType == null)
                        {
                            ConvertType = args.Location.LocationType;
                        }
                        if (Select != null)
                        {
                            args.Value = JsonConvert.DeserializeObject(FlashUtil.Call("selectArrayObjects", Names[GetIndex], Select), ConvertType);
                        }
                        else
                        {
                            args.Value = JsonConvert.DeserializeObject(FlashUtil.Call("getGameObject" + (Static ? "S" : ""), Names[GetIndex]), ConvertType);
                        }
                    }
                    catch
                    {
                        args.Value = DefaultValue ?? _defaultProvider.Provide(ConvertType);
                    }
                }
            }
            else
            {
                base.OnGetValue(args);
            }
        }
Exemplo n.º 7
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     base.OnSetValue(args);
     if (Set)
     {
         try
         {
             if (UseValue)
             {
                 FlashUtil.Call(Name, args.Value);
             }
             else
             {
                 FlashUtil.Call(Name);
             }
         }
         catch
         {
         }
     }
 }
Exemplo n.º 8
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     base.OnSetValue(args);
     FlashUtil.Call($"mod{((bool)args.Value ? "Enable" : "Disable")}", ModuleName);
 }
Exemplo n.º 9
0
 public void Set(int index, T value)
 {
     FlashUtil.Call("lnkSetArray", ID, index, value);
 }
Exemplo n.º 10
0
 public FlashObject <T> Get(int index)
 {
     return(new FlashObject <T>(FlashUtil.Call <int>("lnkGetArray", ID, index)));
 }
Exemplo n.º 11
0
 public FlashCaller ClearArgs()
 {
     FlashUtil.Call("fcClear", _fobj.ID);
     return(this);
 }
Exemplo n.º 12
0
 public FlashCaller PushArgs(params object[] objects)
 {
     FlashUtil.Call("fcPushDirect", new object[] { _fobj.ID }.Concat(objects).ToArray());
     return(this);
 }
Exemplo n.º 13
0
 public FlashCaller PushArgs(params IFlashObject[] objects)
 {
     FlashUtil.Call("fcPush", _fobj.ID, objects.Select(x => x.ID).ToArray());
     return(this);
 }