Esempio 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);
                }
            }
        }
Esempio 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();
            }
        }
Esempio n. 3
0
        public string Call()
        {
            string result = FlashUtil.Call("fcCall", _fobj.ID);

            if (DestroyOnCall)
            {
                Destroy();
            }
            return(result);
        }
Esempio 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);
        }
Esempio 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);
         }
     }
 }
Esempio 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);
            }
        }
Esempio 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
         {
         }
     }
 }
Esempio n. 8
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     base.OnSetValue(args);
     FlashUtil.Call($"mod{((bool)args.Value ? "Enable" : "Disable")}", ModuleName);
 }
Esempio n. 9
0
 public void Set(int index, T value)
 {
     FlashUtil.Call("lnkSetArray", ID, index, value);
 }
Esempio n. 10
0
 public FlashObject <T> Get(int index)
 {
     return(new FlashObject <T>(FlashUtil.Call <int>("lnkGetArray", ID, index)));
 }
Esempio n. 11
0
 public FlashCaller ClearArgs()
 {
     FlashUtil.Call("fcClear", _fobj.ID);
     return(this);
 }
Esempio n. 12
0
 public FlashCaller PushArgs(params object[] objects)
 {
     FlashUtil.Call("fcPushDirect", new object[] { _fobj.ID }.Concat(objects).ToArray());
     return(this);
 }
Esempio n. 13
0
 public FlashCaller PushArgs(params IFlashObject[] objects)
 {
     FlashUtil.Call("fcPush", _fobj.ID, objects.Select(x => x.ID).ToArray());
     return(this);
 }