Exemple #1
0
        public void Begin(TimerUtil.TimerCallback onTimerCallback,
		                       float startTime,
		                       float repeatRate,
		                       int repeatTimes)
        {
            this.onTimerCallback = onTimerCallback;
            this.startTime = startTime;
            this.repeatRate = repeatRate;
            this.repeatTimes = repeatTimes;

            if (repeatRate > 0)
            {
                InvokeRepeating(FUNCTION, startTime, repeatRate);
            }
            else
            {
                Invoke(FUNCTION, startTime);
            }
        }
Exemple #2
0
        public void Begin(TimerUtil.TimerWithArgsCallback onTimerWithArgsCallback,
		                  float startTime,
		                  float repeatRate,
		                  int repeatTimes,
		                  params object[] args)
        {
            this.onTimerWithArgsCallback = onTimerWithArgsCallback;
            this.startTime = startTime;
            this.repeatRate = repeatRate;
            this.repeatTimes = repeatTimes;
            this.args = args;

            if (repeatRate > 0)
            {
                InvokeRepeating(FUNCTION, startTime, repeatRate);
            }
            else
            {
                Invoke(FUNCTION, startTime);
            }
        }
        /**
         * Returns an array of webviews currently managed by the context - composed of primary and the list of those added.
         * This method will always return at least one element; the primary webview.
         *
         * @return Array with all the Webview instances being managed by ARP.
         * @since v2.0
         */
        public Object[] GetWebviews()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing getWebviews...");
            }

            Object[] result = null;
            if (this._delegate != null)
            {
                result = this._delegate.GetWebviews();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'getWebviews' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'getWebviews'.");
                }
            }
            return(result);
        }
        /**
         * Create a service request for the given ServiceToken. This method creates the request, populating
         * existing headers and cookies for the same service. The request is populated with all the defaults
         * for the service being invoked and requires only the request body to be set. Headers and cookies may be
         * manipulated as needed by the application before submitting the ServiceRequest via invokeService.
         *
         * @param serviceToken ServiceToken to be used for the creation of the request.
         * @return ServiceRequest with pre-populated headers, cookies and defaults for the service.
         * @since v2.0.6
         */
        public ServiceRequest GetServiceRequest(ServiceToken serviceToken)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executing getServiceRequest...");
            }

            ServiceRequest result = null;

            if (this._delegate != null)
            {
                result = this._delegate.GetServiceRequest(serviceToken);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executed 'getServiceRequest' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ServiceBridge no delegate for 'getServiceRequest'.");
                }
            }
            return(result);
        }
        /**
         * Executes the given ServiceRequest and provides responses to the given callback handler.
         *
         * @param serviceRequest ServiceRequest with the request body.
         * @param callback       IServiceResultCallback to handle the ServiceResponse.
         * @since v2.0.6
         */
        public void InvokeService(ServiceRequest serviceRequest, IServiceResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executing invokeService...");
            }

            if (this._delegate != null)
            {
                this._delegate.InvokeService(serviceRequest, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executed 'invokeService' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ServiceBridge no delegate for 'invokeService'.");
                }
            }
        }
        /**
         * Determines whether a specific Sensor capability is supported by the
         * device.
         *
         * @param type Type of feature to check.
         * @return true if supported, false otherwise.
         * @since v2.0
         */
        public bool HasSensorSupport(ICapabilitiesSensor type)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executing hasSensorSupport...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.HasSensorSupport(type);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executed 'hasSensorSupport' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "CapabilitiesBridge no delegate for 'hasSensorSupport'.");
                }
            }
            return(result);
        }
Exemple #7
0
        /**
         * Returns the default locale of the application defined in the configuration file
         *
         * @return Default Locale of the application
         * @since v2.0
         */
        public Locale GetDefaultLocale()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GlobalizationBridge executing getDefaultLocale...");
            }

            Locale result = null;

            if (this._delegate != null)
            {
                result = this._delegate.GetDefaultLocale();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GlobalizationBridge executed 'getDefaultLocale' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "GlobalizationBridge no delegate for 'getDefaultLocale'.");
                }
            }
            return(result);
        }
    public void TriggerPunishment(Action CallBack = null)
    {
        StopBornFood();
        StopBornConveyor();
        for (int i = 0; i < foodList.Count; i++)
        {
            if (foodList[i].isUsing)
            {
                foodList[i].splineMove.Pause();
            }
        }
        for (int i = 0; i < conveyorList.Count; i++)
        {
            conveyorList[i].splineMove.Pause();
        }
        // 开始效果
        List <FoodItem> punishList = new List <FoodItem>();

        for (int i = 0; i < foodList.Count; i++)
        {
            if (!foodList[i].isUsing)
            {
                continue;
            }
            if (GameCtrl._Ins.CheckIfInView(foodList[i].transform.position))
            {
                foodList[i].GetComponent <Image>().color = Color.red;
                punishList.Add(foodList[i]);
            }
        }
        if (punishList.Count == 0)
        {
            Debug.Log($"punishList.Count = 0,直接return了");
            CallBack?.Invoke();
            return;
        }

        Vector2 pos1, pos2;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(transform as RectTransform, new Vector2(Screen.width / 2, Screen.height / 2),
                                                                GameCtrl._Ins.UIcamera, out pos1);
        RectTransformUtility.ScreenPointToLocalPointInRectangle(transform as RectTransform, new Vector2(Screen.width, Screen.height),
                                                                GameCtrl._Ins.UIcamera, out pos2);
        for (int i = 0; i < punishList.Count; i++)
        {
            punishList[i].boxcollider.enabled = false;
            //punishList[i].transform.DOLocalMove(pos1, 0.5f);
        }
        TimerUtil.SetTimeOut(0.5f, () => {
            for (int i = 0; i < punishList.Count; i++)
            {
                var item = punishList[i];

                int index = i;
                TimerUtil.SetTimeOut(i * 0.2f, () => {
                    if (index != punishList.Count - 1)
                    {
                        item.transform.DOLocalMove(pos2, 0.5f).OnComplete(() => {
                            item.ResetItem();
                            item.GetComponent <Image>().color = Color.white;
                            Debug.Log($"惩罚废除了dishArriveNum++,惩罚销毁数量:{punishList.Count}");
                            GameCtrl._Ins.DishArriveNum++;
                            GameCtrl._Ins.EC.OnRefreshCurrDishNum?.Invoke(GameCtrl._Ins.DishArriveNum);
                        });
                    }
                    else
                    {
                        // 最后一个加上回调
                        item.transform.DOLocalMove(pos2, 0.5f).OnComplete(() => {
                            item.ResetItem();
                            item.GetComponent <Image>().color = Color.white;
                            Debug.Log($"惩罚废除了dishArriveNum++,惩罚销毁数量:{punishList.Count}");
                            GameCtrl._Ins.DishArriveNum++;
                            GameCtrl._Ins.EC.OnRefreshCurrDishNum?.Invoke(GameCtrl._Ins.DishArriveNum);
                            CallBack?.Invoke();
                        });
                    }
                });
            }
        });
    }
 public void StopBornFood()
 {
     TimerUtil.RemoveTimeOutWithCallBack(foodTimerID);
     TimerUtil.RemoveTimeOut(foodTimerID);
 }
Exemple #10
0
        /**
         * The type of context provided by the getContext method.
         *
         * @return Type of platform context.
         * @since v2.0
         */
        public IOSType GetContextType()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextBridge executing getContextType...");
            }

            IOSType result = IOSType.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.GetContextType();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextBridge executed 'getContextType' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextBridge no delegate for 'getContextType'.");
                }
            }
            return(result);
        }
Exemple #11
0
        /**
         * Method for opening a URL like a link in the native default browser
         *
         * @param url Url to open
         * @return The result of the operation
         * @since v2.0
         */
        public bool OpenExtenalBrowser(string url)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "BrowserBridge executing openExtenalBrowser...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.OpenExtenalBrowser(url);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "BrowserBridge executed 'openExtenalBrowser' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "BrowserBridge no delegate for 'openExtenalBrowser'.");
                }
            }
            return(result);
        }
Exemple #12
0
        /// <summary>
        /// 程序启动
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            #region 是否只能运行一个APP

            bool ret;
            mutex = new System.Threading.Mutex(true, "StickyNotesAPP", out ret);

            if (!ret)
            {
                MessageBox.Show("程序已经运行了");
                Environment.Exit(0);
            }
            #endregion


            Logger.Log().Info("程序启动");
            /// 将全局异常保存到文件目录下
            Current.DispatcherUnhandledException       += App_OnDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //Messenger.Default.Register<SaveMessage>(this, SaveDataMessage);
            var systemtray  = SystemTray.Instance;
            var programData = XMLHelper.DecodeXML <ProgramData>(ConstData.SaveSettingDataName);
            if (programData == null)
            {
                LanguageManager.ChangeLanguage(Language.English);
            }
            else
            {
                LanguageManager.ChangeLanguage(programData.Language);
            }

            if (programData != null)
            {
                var windowsDatas = programData.Datas;
                ProgramData.Instance.IsWindowTopMost     = programData.IsWindowTopMost;
                ProgramData.Instance.IsStartUpWithSystem = programData.IsStartUpWithSystem;
                ProgramData.Instance.CurrentTheme        = programData.CurrentTheme;
                ProgramData.Instance.ShowAllHotKey       = programData.ShowAllHotKey;
                ProgramData.Instance.IsAutoCheckUpdate   = programData.IsAutoCheckUpdate;
                ProgramData.Instance.HideWindowData      = programData.HideWindowData;
                ProgramData.Instance.Language            = programData.Language;
                ThemeAssist.ChangeTheme(programData.CurrentTheme);
                //有创建过的窗口
                if (windowsDatas.Count > 0)
                {
                    for (int i = 0; i < windowsDatas.Count; i++)
                    {
                        OpenNewWindow(windowsDatas[i]);
                    }
                }
                else//以前的窗口都被删掉了
                {
                    OpenNewWindow();
                }
            }
            //没有创建过的窗口
            else
            {
                OpenNewWindow();
            }
            IsInited  = false;
            TimerUtil = new TimerUtil(SaveDataAction);
            new Task(CheckUpdate).Start();
        }
        /**
         * Creates a database on default path for every platform.
         *
         * @param callback Asynchronous callback
         * @param database Database object to create
         * @since v2.0
         */
        public void CreateDatabase(Database database, IDatabaseResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing createDatabase...");
            }

            if (this._delegate != null)
            {
                this._delegate.CreateDatabase(database, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'createDatabase' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'createDatabase'.");
                }
            }
        }
        /**
         * Checks if databaseTable exists by given database name.
         *
         * @param database      Database for databaseTable consulting.
         * @param databaseTable DatabaseTable object with the name of the databaseTable inside.
         * @return True if exists, false otherwise
         * @since v2.0
         */
        public bool ExistsTable(Database database, DatabaseTable databaseTable)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing existsTable...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.ExistsTable(database, databaseTable);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'existsTable' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'existsTable'.");
                }
            }
            return(result);
        }
        /**
         * Executes SQL transaction (some statements chain) inside given database.
         *
         * @param database     The database object reference.
         * @param statements   The statements to be executed during transaction.
         * @param rollbackFlag Indicates if rollback should be performed when any
         *        statement execution fails.
         * @param callback     DatabaseTable callback with the response.
         * @since v2.0
         */
        public void ExecuteSqlTransactions(Database database, string[] statements, bool rollbackFlag, IDatabaseTableResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing executeSqlTransactions...");
            }

            if (this._delegate != null)
            {
                this._delegate.ExecuteSqlTransactions(database, statements, rollbackFlag, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'executeSqlTransactions' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'executeSqlTransactions'.");
                }
            }
        }
        /**
         * Get all the details of a contact according to its id
         *
         * @param contact  id to search for
         * @param callback called for return
         * @since v2.0
         */
        public void GetContact(ContactUid contact, IContactResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ContactBridge executing getContact...");
            }

            if (this._delegate != null)
            {
                this._delegate.GetContact(contact, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ContactBridge executed 'getContact' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ContactBridge no delegate for 'getContact'.");
                }
            }
        }
        /**
         * Invoke a phone call
         *
         * @param number to call
         * @return Status of the call
         * @since v2.0
         */
        public ITelephonyStatus Call(string number)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executing call...");
            }

            ITelephonyStatus result = ITelephonyStatus.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.Call(number);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executed 'call' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "TelephonyBridge no delegate for 'call'.");
                }
            }
            return(result);
        }
        /**
         * Removed all existing listeners from receiving geolocation events.
         *
         * @since v2.0
         */
        public void RemoveGeolocationListeners()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GeolocationBridge executing removeGeolocationListeners...");
            }

            if (this._delegate != null)
            {
                this._delegate.RemoveGeolocationListeners();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GeolocationBridge executed 'removeGeolocationListeners' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "GeolocationBridge no delegate for 'removeGeolocationListeners'.");
                }
            }
        }
 public void StopBornConveyor()
 {
     TimerUtil.RemoveTimeOutWithCallBack(conveyorTimerID);
     TimerUtil.RemoveTimeOut(conveyorTimerID);
 }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="timerEventDefinition"></param>
        /// <param name="interrupting"></param>
        /// <param name="execution"></param>
        /// <param name="timerEventType"></param>
        /// <param name="jobHandlerConfiguration"></param>
        /// <returns></returns>
        public virtual ITimerJobEntity CreateTimerJob(TimerEventDefinition timerEventDefinition, bool interrupting, IExecutionEntity execution, string timerEventType, string jobHandlerConfiguration)
        {
            ITimerJobEntity timerEntity = TimerUtil.CreateTimerEntityForTimerEventDefinition(timerEventDefinition, interrupting, execution, timerEventType, jobHandlerConfiguration);

            return(timerEntity);
        }
    public void TriggerAward(Action CallBack = null)
    {
        StopBornFood();
        StopBornConveyor();
        for (int i = 0; i < foodList.Count; i++)
        {
            if (foodList[i].isUsing)
            {
                foodList[i].splineMove.Pause();
            }
        }
        for (int i = 0; i < conveyorList.Count; i++)
        {
            conveyorList[i].splineMove.Pause();
        }
        List <FoodItem> awardList = new List <FoodItem>();

        for (int i = 0; i < foodList.Count; i++)
        {
            if (!foodList[i].isUsing)
            {
                continue;
            }
            if (GameCtrl._Ins.CheckIfInView(foodList[i].transform.position))
            {
                foodList[i].GetComponent <Image>().color = Color.red;
                awardList.Add(foodList[i]);
            }
        }
        if (awardList.Count == 0)
        {
            Debug.Log($"punishList.Count = 0,直接return了");
            CallBack?.Invoke();
            return;
        }
        Vector2 pos1   = Vector2.zero;
        Vector2 screen = GameCtrl._Ins.UIcamera.WorldToScreenPoint(Player._Ins.transform.position);

        RectTransformUtility.ScreenPointToLocalPointInRectangle(transform as RectTransform, screen,
                                                                GameCtrl._Ins.UIcamera, out pos1);
        for (int i = 0; i < awardList.Count; i++)
        {
            awardList[i].boxcollider.enabled = false;
        }

        TimerUtil.SetTimeOut(0.5f, () => {
            for (int i = 0; i < awardList.Count; i++)
            {
                var item = awardList[i];

                int index = i;
                TimerUtil.SetTimeOut(i * 0.2f, () => {
                    if (index != awardList.Count - 1)
                    {
                        item.transform.DOLocalMove(pos1, 0.5f).OnComplete(() => {
                            item.ResetItem();
                            item.GetComponent <Image>().color = Color.white;
                            GameCtrl._Ins.EC.OnCheckCaptureFood?.Invoke(item);
                        });
                    }
                    else
                    {
                        // 最后一个加上回调
                        item.transform.DOLocalMove(pos1, 0.5f).OnComplete(() => {
                            item.ResetItem();
                            item.GetComponent <Image>().color = Color.white;
                            GameCtrl._Ins.EC.OnCheckCaptureFood?.Invoke(item);
                            CallBack?.Invoke();
                        });
                    }
                });
            }
        });
    }
Exemple #22
0
 void Awake()
 {
     Instance = this;
 }
Exemple #23
0
        /**
         * Send an Email
         *
         * @param data     Payload of the email
         * @param callback Result callback of the operation
         * @since v2.0
         */
        public void SendEmail(Email data, IMessagingCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executing sendEmail...");
            }

            if (this._delegate != null)
            {
                this._delegate.SendEmail(data, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executed 'sendEmail' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "MailBridge no delegate for 'sendEmail'.");
                }
            }
        }
        /**
         * Add the listener for network status changes of the app
         *
         * @param listener Listener with the result
         * @since v2.0
         */
        public void AddNetworkStatusListener(INetworkStatusListener listener)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "NetworkStatusBridge executing addNetworkStatusListener...");
            }

            if (this._delegate != null)
            {
                this._delegate.AddNetworkStatusListener(listener);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "NetworkStatusBridge executed 'addNetworkStatusListener' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "NetworkStatusBridge no delegate for 'addNetworkStatusListener'.");
                }
            }
        }
        /**
         * Obtains the default orientation of the device/display. If no default orientation is available on
         * the platform, this method will return the current orientation. To capture device or display orientation
         * changes please use the IDevice and IDisplay functions and listeners API respectively.
         *
         * @return The default orientation for the device/display.
         * @since v2.0.5
         */
        public ICapabilitiesOrientation GetOrientationDefault()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executing getOrientationDefault...");
            }

            ICapabilitiesOrientation result = ICapabilitiesOrientation.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.GetOrientationDefault();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executed 'getOrientationDefault' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "CapabilitiesBridge no delegate for 'getOrientationDefault'.");
                }
            }
            return(result);
        }
        /**
         * Whether the application dismiss the splash screen successfully or not
         *
         * @return true if the application has dismissed the splash screen;false otherwise
         * @since v2.0
         */
        public bool DismissSplashScreen()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executing dismissSplashScreen...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.DismissSplashScreen();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executed 'dismissSplashScreen' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "RuntimeBridge no delegate for 'dismissSplashScreen'.");
                }
            }
            return(result);
        }
        /**
         * Checks whether a specific service, endpoint, function and method type is configured in the platform's
         * XML service definition file.
         *
         * @param serviceName  Service name.
         * @param endpointName Endpoint name.
         * @param functionName Function name.
         * @param method       Method type.
         * @return Returns true if the service is configured, false otherwise.
         * @since v2.0.6
         */
        public bool IsServiceRegistered(string serviceName, string endpointName, string functionName, IServiceMethod method)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executing isServiceRegistered...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.IsServiceRegistered(serviceName, endpointName, functionName, method);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executed 'isServiceRegistered' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ServiceBridge no delegate for 'isServiceRegistered'.");
                }
            }
            return(result);
        }
        /**
         * Dismiss the current Application
         *
         * @since v2.0
         */
        public void DismissApplication()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executing dismissApplication...");
            }

            if (this._delegate != null)
            {
                this._delegate.DismissApplication();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executed 'dismissApplication' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "RuntimeBridge no delegate for 'dismissApplication'.");
                }
            }
        }
        /**
         * Evaluate the specified javascript on the specified webview of the application.
         *
         * @param javaScriptText   The javascript expression to execute on the webview.
         * @param webViewReference The target webview on which to execute the expression.
         */
        public void ExecuteJavaScript(string javaScriptText, Object webViewReference)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing executeJavaScript...");
            }

            if (this._delegate != null)
            {
                this._delegate.ExecuteJavaScript(javaScriptText, webViewReference);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'executeJavaScript' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'executeJavaScript'.");
                }
            }
        }
Exemple #30
0
 void startCmdThread()
 {
     TimerUtil.start(10, newThread);
 }
        /**
         * Additional views may be added to an application - a separate activity - and if these will make calls to the
         * ARP methods, they must be registered by adding them to the context. When they are added to the context, ARP
         * methods are bound to the webview so that they're callable from the HTML application. The primary webview should
         * not be added using this method.
         *
         * @param webView Platform specific webview reference (WebView, UIWebView, WKWebView,etc.)
         * @since v2.0
         */
        public void AddWebview(Object webView)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing addWebview...");
            }

            if (this._delegate != null)
            {
                this._delegate.AddWebview(webView);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'addWebview' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'addWebview'.");
                }
            }
        }
        /**
         * Set the contact photo
         *
         * @param contact  id to assign the photo
         * @param pngImage photo as byte array
         * @return true if set is successful;false otherwise
         * @since v2.0
         */
        public bool SetContactPhoto(ContactUid contact, byte[] pngImage)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ContactBridge executing setContactPhoto...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.SetContactPhoto(contact, pngImage);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ContactBridge executed 'setContactPhoto' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ContactBridge no delegate for 'setContactPhoto'.");
                }
            }
            return(result);
        }