Exemplo n.º 1
0
        public static bool OnUpdate(string gameObejctName, string actionName)
        {
            EventParames EventParames;

            GetGameObject(gameObejctName, out EventParames)[0].OnUpdate(EventFunctionLibrary.GetAction(actionName), EventParames);

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Unity的等待事件,单位秒;
        /// </summary>
        /// <param name="waitTime"></param>
        /// <param name="actionName"></param>
        /// <returns></returns>
        public static bool OnWaitSecond(string waitTime, string actionName = null, string parameters = null)
        {
            float time = CastString.CastToNumbers <float>(waitTime)[0];

            if (string.IsNullOrEmpty(parameters))
            {
                UnityEventService.OnWaitSecond(time, EventFunctionLibrary.GetAction(actionName));
            }

            else
            {
                UnityEventService.OnWaitSecond(time, EventFunctionLibrary.GetActionT(actionName), parameters);
            }

            return(true);
        }
        /// <summary>
        /// 鼠标右键抬起;
        /// </summary>
        public static bool OnMouseRightUp(string gameObjectName, string actionName = null, string parameters = null)
        {
            EventParames EventParames;

            GameObject go = GetGameObject(gameObjectName, out EventParames)[0];

            if (!string.IsNullOrEmpty(parameters))
            {
                go.OnMouseRightUp(EventFunctionLibrary.GetActionT(actionName), parameters, EventParames);

                return(true);
            }

            go.OnMouseRightUp(EventFunctionLibrary.GetAction(actionName), EventParames);

            return(true);
        }
        /// <summary>
        ///  鼠标拖拽;
        /// </summary>
        /// <param name="gameObjectName"></param>
        /// <param name="actionName"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static bool OnMouseDrag(string gameObjectName, string actionName = null, string parameters = null)
        {
            EventParames EventParames;

            GameObject[] gameObjects = GetGameObject(gameObjectName, out EventParames);

            switch (gameObjects.Length)
            {
            case 1:

                if (!string.IsNullOrEmpty(parameters))
                {
                    gameObjects[0].OnMouseDrag(EventFunctionLibrary.GetActionT(actionName), parameters, EventParames);

                    return(true);
                }

                gameObjects[0].OnMouseDrag(EventFunctionLibrary.GetAction(actionName), EventParames);

                break;

            case 2:

                if (!string.IsNullOrEmpty(parameters))
                {
                    gameObjects[0].OnMouseDrag(gameObjects[1], EventFunctionLibrary.GetActionT(actionName), parameters, EventParames);

                    return(true);
                }

                if (actionName == null)
                {
                    gameObjects[0].OnMouseDrag(gameObjects[1], null, EventParames);
                }
                else
                {
                    gameObjects[0].OnMouseDrag(gameObjects[1], EventFunctionLibrary.GetAction(actionName), EventParames);
                }

                break;
            }

            return(true);
        }
        // 解析 actionName,判断对函数是保留还是移除操作;TODO


        /// <summary>
        ///  鼠标左键按下事件;
        /// </summary>
        public static bool OnMouseLeftDown(string gameObjectName, string actionName = null, string parameters = null)
        {
            // 在客户端自定义的函数库中搜寻 action;

            EventParames EventParames;

            GameObject go = GetGameObject(gameObjectName, out EventParames)[0];

            // 如果是有参委托;

            if (!string.IsNullOrEmpty(parameters))
            {
                go.OnMouseLeftDown(EventFunctionLibrary.GetActionT(actionName), parameters, EventParames);

                return(true);
            }

            go.OnMouseLeftDown(EventFunctionLibrary.GetAction(actionName), EventParames);

            return(true);
        }