示例#1
0
        private static bool parseInvokeMethod(JSONAction a)
        {
            if (a.strings == null || a.strings.Length < 2)
            {
                Debug.LogWarning("Animator: SendMessage missing Component or MethodInfo Name.");
                return(false);
            }
            //AMTween.InvokeMethod(component,AMTween.Hash ("delay",getWaitTime(frameRate),"methodinfo",methodInfo,"parameters",arrParams));
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("methodinfo", getMethodInfo(a.go, a.strings[0], a.strings[1], null));
            if (a.eventParams != null && a.eventParams.Length > 0)
            {
                object[] arrParams = new object[a.eventParams.Length];
                for (int i = 0; i < a.eventParams.Length; i++)
                {
                    arrParams[i] = a.eventParams[i].toObject();
                }
                if (arrParams.Length <= 0)
                {
                    arrParams = null;
                }
                hash.Add("parameters", arrParams);
            }
            //AMTween.InvokeMethod(getCMP(a.go,a.strings[0]),hash);
            return(true);
        }
示例#2
0
        private static bool parsePlayAudio(JSONAction a)
        {
            //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            if (a.strings.Length >= 1)
            {
                AudioClip audioClip = (AudioClip)Resources.Load(a.strings[0]);
                if (audioClip == null)
                {
                    Debug.LogWarning("Animator: Could not find AudioClip '" + a.strings[0] + "'. Make sure the audio file is placed in a Resources folder!");
                    return(false);
                }
                hash.Add("audioclip", audioClip);
            }
            else
            {
                Debug.LogWarning("Animator: PlayAudio missing 'audioclip' clip name.");
                return(false);
            }
            if (a.bools.Length >= 1)
            {
                hash.Add("loop", a.bools[0]);
            }
            else
            {
                Debug.LogWarning("Animator: PlayAudio missing 'loop'.");
                return(false);
            }
            //AMTween.PlayAudio((AudioSource)getCMP(a.go,"AudioSource"), hash);
            return(true);
        }
        private JSONResponse <dynamic> OnMessageReceived(JSONAction <dynamic> Message)
        {
            Console.WriteLine($"Message Recived.\n{Message}");
            switch (Message.ActionName)
            {
            case "StopGame":
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }

            case "ClearCharges":
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }

            case "GetSlaveInfo":
            {
                JSONResponse <SlaveInfo> Return = new JSONResponse <SlaveInfo>()
                {
                    ActionName = Message.ActionName, ActionData = Info, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return.ToDynamic());
            }

            case "StartGame":
            {
                //AttendantConsole.ActivateForTappedCard(Message.DynamicAutoCast<SlaveInfo>().ActionData);
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }

            default:
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = Message.ActionData, Message = "The Client has failed to find the requested action.", RequestStatus = JSONResponseStatus.ActionNotFound
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }
            }
        }
        public JSONResponse <object> NotifyOfCardTap()
        {
            JSONAction <object> Commandpackage = new JSONAction <object>()
            {
                ActionName = "OnCardTap", ActionData = new { }
            };

            return(ClientPipe.SendCommandRequest <object, object>(Commandpackage));
        }
    private static bool parseCameraFade(JSONAction a)
    {
        if (a.ints == null || a.ints.Length < 3)
        {
            Debug.LogWarning("Animator: CameraFade missing fade type, start or end targets.");
            return(false);
        }
        if (a.strings == null || a.strings.Length < 2 || a.colors == null || a.colors.Length < 2)
        {
            Debug.LogWarning("Animator: CameraFade missing start or end targets.");
            return(false);
        }
        Hashtable hash = new Hashtable();

        hash.Add("time", a.time);
        hash.Add("delay", a.delay);
        setupHashEase(hash, a);
        if (a.bools != null && a.bools.Length > 0)
        {
            hash.Add("reversed", a.bools[0]);
        }
        if (a.ints[1] == 0 || a.ints[2] == 0)
        {
            hash.Add("allcameras", allCameras);
        }
        if (a.stringsExtra != null && a.stringsExtra.Length > 0)
        {
            hash.Add("texture", AMTween.LoadTexture2D(a.stringsExtra[0]));
        }
        if (a.ints[1] == 0)
        {
            hash.Add("camera1", getGO(a.strings[0]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color1", a.colors[0].toColor());
        }
        if (a.ints[2] == 0)
        {
            hash.Add("camera2", getGO(a.strings[1]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color2", a.colors[1].toColor());
        }

        float[] parameters = a.floats;
        if (parameters == null)
        {
            parameters = new float[] {}
        }
        ;

        AMTween.CameraFade(a.ints[0], (a.bools == null || a.bools.Length < 2 ? false : a.bools[1]), parameters, hash);
        return(true);
    }
        public JSONResponse <GetMachineGamesReturn> GetGames(JSONAction <object> This)
        {
            ArcadeGameStartAndStopService.Logger.WriteLog($"Get Games was called\nWith Data:\n{This}\n");
            JSONResponse <GetMachineGamesReturn> Return = new JSONResponse <GetMachineGamesReturn>()
            {
                ActionData = new GetMachineGamesReturn(), ActionName = This.ActionName, RequestStatus = JSONResponseStatus.Success
            };

            Return.ActionData.VRMachineGames = ArcadeGameStartAndStopService.GameConfig.GamesRaw;
            ArcadeGameStartAndStopService.Logger.WriteLog($"Retuning to get games with:\n{Return}\n");
            return(Return);
        }
示例#7
0
 private static void setupHashFieldOrPropertyInfo(Hashtable hash, JSONAction a)
 {
     if (a.strings.Length < 4)
     {
         Debug.LogWarning("Animator: PropertyTo missing Component or property type.");
         return;
     }
     if (a.strings[2] == "fieldinfo")
     {
         hash.Add("fieldinfo", getFieldInfo(a.go, a.strings[0], a.strings[3]));
     }
     else
     {
         hash.Add("propertyinfo", getPropertyInfo(a.go, a.strings[0], a.strings[3]));
     }
 }
        public JSONResponse <PlayGameReturn> PlayGame(JSONAction <PlayInput> This)
        {
            JSONResponse <PlayGameReturn> Return = new JSONResponse <PlayGameReturn>()
            {
                ActionName = This.ActionName, RequestStatus = JSONResponseStatus.Success
            };

            if (ArcadeGameStartAndStopService.MainConfig.ServerMode == ServerMode.NoServerDemoMode || ArcadeGameStartAndStopService.MainConfig.CardModeMode == CardModeMode.NoCardNeededDemoMode)
            {
                ArcadeGameStartAndStopService.Logger.WriteLog($"Play game called\nWith Data:\n{This}");
                Return.ActionData = new PlayGameReturn()
                {
                    ActivationDate = DateTime.Now,
                    Comments       = "machine purchase",
                    CheckNum       = 0,
                    Number         = "",
                    IsActive       = true,
                    IsDeleted      = false,
                    Customer       = new CustomerData(),
                    LimitBalance   = 0,
                    ExpiryDate     = DateTime.Now,
                    ID             = new Guid()
                };

                Task Task = new Task(() =>
                {
                    Thread.Sleep(2000);
                    this.PlayGameEvent?.Invoke(this, new PlayGameEventArgs(This.ActionData));
                });
                Task.Start();
            }
            else if (ArcadeGameStartAndStopService.LastCardGUID != null && ArcadeGameStartAndStopService.LastCheckKey != null)
            {
                ArcadeGameStartAndStopService.Logger.WriteLog($"Play game called\nWith Data:\n{This}");
                Return.ActionData = ArcadeGameStartAndStopService.TheServerClient.PlayGame(ArcadeGameStartAndStopService.LastCardGUID, ArcadeGameStartAndStopService.LastCheckKey.Value, This.ActionData.GameGUID).Data;
            }
            else
            {
                throw new Exception("Shouldn't be possible");
            }



            ArcadeGameStartAndStopService.Logger.WriteLog($"Retuning with:\n{Return}\n");
            return(Return);
        }
示例#9
0
        private static bool parseLookFollow(JSONAction a)
        {
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("time", a.time);
            setupHashEase(hash, a);
            if (a.strings.Length >= 1)
            {
                hash.Add("looktarget", getGO(a.strings[0]).transform);                                  // move to position
            }
            else
            {
                Debug.LogWarning("Animator: LookFollow missing 'looktarget'.");
                return(false);
            }
            //AMTween.LookFollow(getGO(a.go), hash);
            return(true);
        }
示例#10
0
        private static bool parseRotateTo(JSONAction a)
        {
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("time", a.time);
            setupHashEase(hash, a);
            if (a.path.Length >= 1)
            {
                hash.Add("rotation", a.path[0].toVector3());                               // rotate to eulerAngle
            }
            else
            {
                Debug.LogWarning("Animator: RotateTo missing 'rotation'.");
                return(false);
            }
            //AMTween.RotateTo(getGO(a.go), hash);
            return(true);
        }
示例#11
0
        private static bool parseSendMessage(JSONAction a)
        {
            if (a.strings == null || a.strings.Length < 1)
            {
                Debug.LogWarning("Animator: SendMessage missing Method Name.");
                return(false);
            }
            //AMTween.SendMessage(component.gameObject, AMTween.Hash ("delay", getWaitTime(frameRate), "methodname", methodName, "parameter", parameters[0].toObject()));
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("methodname", a.strings[0]);
            if (a.eventParams != null && a.eventParams.Length > 0)
            {
                hash.Add("parameter", a.eventParams[0].toObject());
            }
            //AMTween.SendMessage(getGO(a.go),hash);
            return(true);
        }
示例#12
0
        private JSONResponse <dynamic> OnMessageReceived(JSONAction <dynamic> Message)
        {
            switch (Message.ActionName)
            {
            case "NotifyOfGamesEnd":
            {
                SlaveInfo Data = Message.DynamicAutoCast <SlaveInfo>().ActionData;
                AttendantConsole.MarkGameAsStoped(Data);
                AttendantConsole.Log($"{Data} Has stopped its game.");
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return.ToDynamic());
            }

            case "CardTapped":
            {
                SlaveInfo Data = Message.DynamicAutoCast <SlaveInfo>().ActionData;
                AttendantConsole.ActivateForTappedCard(Message.DynamicAutoCast <SlaveInfo>().ActionData);
                AttendantConsole.Log($"{Data} Has detected a card tap. Setting to active start.");
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return.ToDynamic());
            }

            default:
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = Message.ActionData, Message = "The Client has failed to find the requested action.", RequestStatus = JSONResponseStatus.ActionNotFound
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }
            }
        }
示例#13
0
        private static bool parsePlayAnimation(JSONAction a)
        {
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            if (a.strings.Length >= 1)
            {
                hash.Add("animation", a.strings[0]);
            }
            else
            {
                Debug.LogWarning("Animator: PlayAnimation missing 'animation' clip name.");
                return(false);
            }
            if (a.floats.Length >= 2)
            {
                hash.Add("wrapmode", (WrapMode)a.floats[0]);
                hash.Add("fadeLength", a.floats[1]);
            }
            else
            {
                Debug.LogWarning("Animator: PlayAnimation missing 'wrapmode' or 'fadeLength'.");
                return(false);
            }
            if (a.bools.Length >= 1)
            {
                hash.Add("crossfade", a.bools[0]);
            }
            else
            {
                Debug.LogWarning("Animator: PlayAnimation missing 'crossfade'.");
                return(false);
            }
            //AMTween.PlayAnimation(getGO(a.go), hash);
            return(true);
        }
        public JSONResponse <CanPlayReturn> CanPlayGame(JSONAction <PlayInput> This)
        {
            JSONResponse <CanPlayReturn> Return = new JSONResponse <CanPlayReturn>()
            {
                ActionName = This.ActionName, RequestStatus = JSONResponseStatus.Success
            };

            if (ArcadeGameStartAndStopService.MainConfig.ServerMode == ServerMode.NoServerDemoMode || ArcadeGameStartAndStopService.MainConfig.CardModeMode == CardModeMode.NoCardNeededDemoMode)
            {
                ArcadeGameStartAndStopService.Logger.WriteLog($"Can play game called\nWith Data:\n{This}\n");
                Return.ActionData = new CanPlayReturn()
                {
                    CanPlay        = true,
                    CurrentBalance = 300.00,
                    NewBalance     = 280.00,
                    //NewCheckKey = 0
                };
            }
            else
            {
                ArcadeGameStartAndStopService.Logger.WriteLog($"Play game called\nWith Data:\n{This}");
                CanPlayTransactionReturn Data = ArcadeGameStartAndStopService.NFCReader.Card.CanPlayGameTransactionWithServer(This.ActionData.GameGUID).Data;
                if (Data.CanPlay)
                {
                    ArcadeGameStartAndStopService.LastCardGUID = Data.CardGUID;
                    ArcadeGameStartAndStopService.LastCheckKey = Data.NewCheckKey;
                }
                else
                {
                    ArcadeGameStartAndStopService.LastCardGUID = null;
                    ArcadeGameStartAndStopService.LastCheckKey = null;
                }
                Return.ActionData = Data;
            }
            ArcadeGameStartAndStopService.Logger.WriteLog($"Retuning with:\n{Return}\n");
            return(Return);
        }
示例#15
0
        private static bool parseMoveTo(JSONAction a)
        {
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("time", a.time);
            setupHashEase(hash, a);
            if (a.path.Length > 1)
            {
                hash.Add("path", a.getVector3Path());                              // move to position
            }
            else if (a.path.Length == 1)
            {
                hash.Add("position", a.path[0].toVector3());                                     // move with path
            }
            else
            {
                Debug.LogWarning("Animator: MoveTo missing 'position' or 'path'.");
                return(false);
            }
            //AMTween.MoveTo(getGO(a.go), hash);
            return(true);
        }
    private static bool parseCameraFade(JSONAction a)
    {
        if(a.ints == null || a.ints.Length < 3) {
            Debug.LogWarning("Animator: CameraFade missing fade type, start or end targets.");
            return false;
        }
        if(a.strings == null || a.strings.Length < 2 || a.colors == null || a.colors.Length < 2) {
            Debug.LogWarning("Animator: CameraFade missing start or end targets.");
            return false;
        }
        Hashtable hash = new Hashtable();
        hash.Add("time",a.time);
        hash.Add("delay",a.delay);
        setupHashEase(hash, a);
        if(a.bools != null && a.bools.Length > 0) hash.Add("reversed",a.bools[0]);
        if(a.ints[1] == 0 || a.ints[2] == 0) hash.Add("allcameras",allCameras);
        if(a.stringsExtra != null && a.stringsExtra.Length > 0) hash.Add("texture",AMTween.LoadTexture2D(a.stringsExtra[0]));
        if(a.ints[1] == 0) hash.Add("camera1",getGO(a.strings[0]).camera);
        else hash.Add("color1",a.colors[0].toColor());
        if(a.ints[2] == 0) hash.Add("camera2",getGO(a.strings[1]).camera);
        else hash.Add("color2",a.colors[1].toColor());

        float[] parameters = a.floats;
        if(parameters == null) parameters = new float[]{};

        AMTween.CameraFade(a.ints[0],(a.bools == null || a.bools.Length < 2 ? false : a.bools[1]),parameters,hash);
        return true;
    }
示例#17
0
        private JSONResponse <dynamic> OnMessageReceived(JSONAction <dynamic> Message)
        {
            Console.WriteLine($"Message Recived.\n{Message}");
            switch (Message.ActionName)
            {
            //ChangeGame
            case "ChangeGame":
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                GameGUID = Message.DynamicAutoCast <PlayGameModel>().ActionData.GUID;
                ArcadeGameStartAndStopService.Logger.WriteLog($"ChangeGame from Master Server for {GameGUID}");
                return(Return);
            }

            case "StopGame":
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                ArcadeGameStartAndStopService.Logger.WriteLog($"StopGame from Master Server");
                ArcadeGameStartAndStopService.GameStarter.KillGame();
                return(Return);
            }

            case "ClearCharges":
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                ArcadeGameStartAndStopService.Logger.WriteLog($"Clear Charge was called. Now clearing charges");
                ArcadeGameStartAndStopService.LastCardGUID = null;
                ArcadeGameStartAndStopService.LastCheckKey = null;
                return(Return);
            }

            case "GetSlaveInfo":
            {
                JSONResponse <SlaveInfo> Return = new JSONResponse <SlaveInfo>()
                {
                    ActionName = Message.ActionName, ActionData = Info, RequestStatus = JSONResponseStatus.Success
                };
                GameGUID = Message.DynamicAutoCast <PlayGameModel>().ActionData.GUID;
                return(Return.ToDynamic());
            }

            case "StartGame":
            {
                //AttendantConsole.ActivateForTappedCard(Message.DynamicAutoCast<SlaveInfo>().ActionData);
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                ArcadeGameStartAndStopService.Logger.WriteLog($"StartGameCalled from Master Server");
                if (ArcadeGameStartAndStopService.LastCardGUID != null && ArcadeGameStartAndStopService.LastCheckKey != null)
                {
                    ArcadeGameStartAndStopService.TheServerClient.PlayGame(Message.DynamicAutoCast <PlayGameModel>().ActionData.GUID, ArcadeGameStartAndStopService.LastCheckKey.Value, ArcadeGameStartAndStopService.LastCardGUID);
                }
                ArcadeGameStartAndStopService.GameStarter.StartGame(this, Message.DynamicAutoCast <PlayGameModel>().ActionData.GUID);
                return(Return);
            }

            default:
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = Message.ActionData, Message = "The Client has failed to find the requested action.", RequestStatus = JSONResponseStatus.ActionNotFound
                };
                ArcadeGameStartAndStopService.Logger.WriteLog($"No match fuction called returning with {Return}", UtilitiesFolder.LoggerWarringLevel.Warring);
                return(Return);
            }
            }
        }
示例#18
0
 private static bool parseInvokeMethod(JSONAction a)
 {
     if(a.strings == null || a.strings.Length < 2) {
         Debug.LogWarning("Animator: SendMessage missing Component or MethodInfo Name.");
         return false;
     }
     //AMTween.InvokeMethod(component,AMTween.Hash ("delay",getWaitTime(frameRate),"methodinfo",methodInfo,"parameters",arrParams));
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     hash.Add("methodinfo",getMethodInfo(a.go,a.strings[0],a.strings[1],null));
     if(a.eventParams != null && a.eventParams.Length > 0) {
         object[] arrParams = new object[a.eventParams.Length];
         for(int i=0;i<a.eventParams.Length;i++) {
             arrParams[i] = a.eventParams[i].toObject();
         }
         if(arrParams.Length<=0) arrParams = null;
         hash.Add("parameters",arrParams);
     }
     //AMTween.InvokeMethod(getCMP(a.go,a.strings[0]),hash);
     return true;
 }
示例#19
0
        private static bool parsePropertyTo(JSONAction a)
        {
            //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
            Hashtable hash = new Hashtable();

            hash.Add("disable", true);
            hash.Add("delay", a.delay);
            hash.Add("time", a.time);
            setupHashEase(hash, a);

            if (a.strings == null || a.strings.Length < 2)
            {
                Debug.LogWarning("Animator: PropertyTo missing Component or property type.");
                return(false);
            }

            //string componentName = a.strings[0];
            bool missingTargets = false;

            switch (a.strings[1])
            {
            case "morph":
                if (a.floats == null || a.floatsExtra == null)
                {
                    missingTargets = true;
                }
                hash.Add("methodtype", "morph");
                hash.Add("methodinfo", getMethodInfo(a.go, "MegaMorph", "SetPercent", new string[] { "System.Int32", "System.Single" }));
                hash.Add("from", a.floats);
                hash.Add("to", a.floatsExtra);
                break;

            case "integer":
                if (a.ints == null || a.ints.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.ints[0]);
                hash.Add("to", a.ints[1]);
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "long":
                if (a.longs == null || a.longs.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.longs[0]);
                hash.Add("to", a.longs[1]);
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "float":
                if (a.floats == null || a.floats.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.floats[0]);
                hash.Add("to", a.floats[1]);
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "double":
                if (a.doubles == null || a.doubles.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.doubles[0]);
                hash.Add("to", a.doubles[1]);
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "vector2":
                if (a.vect2s == null || a.vect2s.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.vect2s[0].toVector2());
                hash.Add("to", a.vect2s[1].toVector2());
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "vector3":
                if (a.path == null || a.path.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.path[0].toVector3());
                hash.Add("to", a.path[1].toVector3());
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "color":
                if (a.colors == null || a.colors.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.colors[0].toColor());
                hash.Add("to", a.colors[1].toColor());
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            case "rect":
                if (a.rects == null || a.rects.Length < 2)
                {
                    missingTargets = true;
                }
                hash.Add("from", a.rects[0].toRect());
                hash.Add("to", a.rects[1].toRect());
                setupHashFieldOrPropertyInfo(hash, a);
                break;

            default:
                Debug.LogWarning("Animator: PropertyTo unknown property type '" + a.strings[1] + "'.");
                return(false);
            }

            if (missingTargets)
            {
                Debug.LogWarning("Animator: PropertyTo missing 'to' or 'from' targets.");
                return(false);
            }
            //AMTween.PropertyTo(getCMP(a.go,componentName),hash);
            //AMTween.PlayAudio((AudioSource)getCMP(a.go,"AudioSource"), hash);
            return(true);
        }
示例#20
0
 private static bool parseLookToFollow(JSONAction a)
 {
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     hash.Add("time",a.time);
     setupHashEase(hash, a);
     if(a.strings.Length >= 1) hash.Add("looktarget",getGO(a.strings[0]).transform); // move to position
     else {
         Debug.LogWarning("Animator: LookFollow missing 'looktarget'.");
         return false;
     }
     if(a.path != null && a.path.Length >=1) {
         hash.Add("endposition",a.path[0].toVector3());
     }
     //AMTween.LookToFollow(getGO(a.go), hash);
     return true;
 }
示例#21
0
 private static bool parseMoveTo(JSONAction a)
 {
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     hash.Add("time",a.time);
     setupHashEase(hash, a);
     if(a.path.Length > 1) hash.Add("path",a.getVector3Path()); // move to position
     else if(a.path.Length == 1) hash.Add("position", a.path[0].toVector3()); // move with path
     else {
         Debug.LogWarning("Animator: MoveTo missing 'position' or 'path'.");
         return false;
     }
     //AMTween.MoveTo(getGO(a.go), hash);
     return true;
 }
示例#22
0
 private static bool parsePlayAnimation(JSONAction a)
 {
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     if(a.strings.Length >= 1) hash.Add("animation",a.strings[0]);
     else {
         Debug.LogWarning("Animator: PlayAnimation missing 'animation' clip name.");
         return false;
     }
     if(a.floats.Length >= 2) {
         hash.Add("wrapmode",(WrapMode)a.floats[0]);
         hash.Add("fadeLength",a.floats[1]);
     } else {
         Debug.LogWarning("Animator: PlayAnimation missing 'wrapmode' or 'fadeLength'.");
         return false;
     }
     if(a.bools.Length >= 1) {
         hash.Add("crossfade",a.bools[0]);
     } else {
         Debug.LogWarning("Animator: PlayAnimation missing 'crossfade'.");
         return false;
     }
     //AMTween.PlayAnimation(getGO(a.go), hash);
     return true;
 }
示例#23
0
 private static bool parsePlayAudio(JSONAction a)
 {
     //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     if(a.strings.Length >= 1) {
         AudioClip audioClip = (AudioClip) Resources.Load(a.strings[0]);
         if(audioClip == null) {
             Debug.LogWarning("Animator: Could not find AudioClip '"+a.strings[0]+"'. Make sure the audio file is placed in a Resources folder!");
             return false;
         }
         hash.Add("audioclip",audioClip);
     }
     else {
         Debug.LogWarning("Animator: PlayAudio missing 'audioclip' clip name.");
         return false;
     }
     if(a.bools.Length >= 1) {
         hash.Add("loop",a.bools[0]);
     } else {
         Debug.LogWarning("Animator: PlayAudio missing 'loop'.");
         return false;
     }
     //AMTween.PlayAudio((AudioSource)getCMP(a.go,"AudioSource"), hash);
     return true;
 }
示例#24
0
        private static bool parsePropertyTo(JSONAction a)
        {
            //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
            Hashtable hash = new Hashtable();
            hash.Add("disable",true);
            hash.Add("delay",a.delay);
            hash.Add("time",a.time);
            setupHashEase(hash, a);

            if(a.strings == null || a.strings.Length < 2) {
                Debug.LogWarning("Animator: PropertyTo missing Component or property type.");
                return false;
            }

            //string componentName = a.strings[0];
            bool missingTargets = false;
            switch(a.strings[1]) {
            case "morph":
                if(a.floats == null || a.floatsExtra == null) missingTargets = true;
                hash.Add("methodtype","morph");
                hash.Add("methodinfo",getMethodInfo(a.go,"MegaMorph","SetPercent",new string[]{"System.Int32","System.Single"}));
                hash.Add("from",a.floats);
                hash.Add("to",a.floatsExtra);
                break;
            case "integer":
                if(a.ints == null || a.ints.Length < 2) missingTargets = true;
                hash.Add("from",a.ints[0]);
                hash.Add("to",a.ints[1]);
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "long":
                if(a.longs == null || a.longs.Length < 2) missingTargets = true;
                hash.Add("from",a.longs[0]);
                hash.Add("to",a.longs[1]);
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "float":
                if(a.floats == null || a.floats.Length < 2) missingTargets = true;
                hash.Add("from",a.floats[0]);
                hash.Add("to",a.floats[1]);
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "double":
                if(a.doubles == null || a.doubles.Length < 2) missingTargets = true;
                hash.Add("from",a.doubles[0]);
                hash.Add("to",a.doubles[1]);
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "vector2":
                if(a.vect2s == null || a.vect2s.Length < 2) missingTargets = true;
                hash.Add("from",a.vect2s[0].toVector2());
                hash.Add("to",a.vect2s[1].toVector2());
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "vector3":
                if(a.path == null || a.path.Length < 2) missingTargets = true;
                hash.Add("from",a.path[0].toVector3());
                hash.Add("to",a.path[1].toVector3());
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "color":
                if(a.colors == null || a.colors.Length < 2) missingTargets = true;
                hash.Add("from",a.colors[0].toColor());
                hash.Add("to",a.colors[1].toColor());
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            case "rect":
                if(a.rects == null || a.rects.Length < 2) missingTargets = true;
                hash.Add("from",a.rects[0].toRect());
                hash.Add("to",a.rects[1].toRect());
                setupHashFieldOrPropertyInfo(hash,a);
                break;
            default:
                Debug.LogWarning("Animator: PropertyTo unknown property type '"+a.strings[1]+"'.");
                return false;
            }

            if(missingTargets) {
                Debug.LogWarning("Animator: PropertyTo missing 'to' or 'from' targets.");
                return false;
            }
            //AMTween.PropertyTo(getCMP(a.go,componentName),hash);
            //AMTween.PlayAudio((AudioSource)getCMP(a.go,"AudioSource"), hash);
            return true;
        }
示例#25
0
 private static bool parseRotateTo(JSONAction a)
 {
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     hash.Add("time",a.time);
     setupHashEase(hash, a);
     if(a.path.Length >= 1) hash.Add("rotation",a.path[0].toVector3()); // rotate to eulerAngle
     else {
         Debug.LogWarning("Animator: RotateTo missing 'rotation'.");
         return false;
     }
     //AMTween.RotateTo(getGO(a.go), hash);
     return true;
 }
示例#26
0
 private static bool parseSendMessage(JSONAction a)
 {
     if(a.strings == null || a.strings.Length < 1) {
         Debug.LogWarning("Animator: SendMessage missing Method Name.");
         return false;
     }
     //AMTween.SendMessage(component.gameObject, AMTween.Hash ("delay", getWaitTime(frameRate), "methodname", methodName, "parameter", parameters[0].toObject()));
     Hashtable hash = new Hashtable();
     hash.Add("disable",true);
     hash.Add("delay",a.delay);
     hash.Add("methodname",a.strings[0]);
     if(a.eventParams != null && a.eventParams.Length > 0) {
         hash.Add("parameter",a.eventParams[0].toObject());
     }
     //AMTween.SendMessage(getGO(a.go),hash);
     return true;
 }
示例#27
0
 private static void setupHashFieldOrPropertyInfo(Hashtable hash, JSONAction a)
 {
     if(a.strings.Length < 4) {
         Debug.LogWarning("Animator: PropertyTo missing Component or property type.");
         return;
     }
     if(a.strings[2] == "fieldinfo") hash.Add("fieldinfo",getFieldInfo(a.go,a.strings[0],a.strings[3]));
     else hash.Add("propertyinfo",getPropertyInfo(a.go,a.strings[0],a.strings[3]));
 }