Ejemplo n.º 1
0
        public void Run()
        {
            if (Status != LoaderStatus.Ready)
            {
                return;
            }

            List <UmiItem> euroMadeData = null;

            status = LoaderStatus.Download;

            try
            {
                euroMadeData = Repository.EuroMade.Download((state) => Progress = state);
            }
            catch (MySqlException e)
            {
                status = LoaderStatus.Disconnected;
                return;
            }

            status = LoaderStatus.Upload;
            Repository.EuroMade.Upload(euroMadeData, (state) => Progress = state);

            status = LoaderStatus.Done;
        }
 private void OnTriggerExit(Collider other)
 {
     if (status != LoaderStatus.NotLoaded)
     {
         status = LoaderStatus.NotLoaded;
         StartCoroutine(UnloadAsyncScene());
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (status == LoaderStatus.NotLoaded)
     {
         status = LoaderStatus.Loading;
         StartCoroutine(LoadAsyncScene());
     }
 }
        IEnumerator LoadAsyncScene()
        {
            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(this.sceneName, LoadSceneMode.Additive);

            // Wait until the asynchronous scene fully loads
            while (!asyncLoad.isDone)
            {
                yield return(null);
            }
            status = LoaderStatus.Loaded;
        }
Ejemplo n.º 5
0
 private MissionResult RunRecipe(CRecipe rec)
 {
     this._RobotManager.SetRec_Loader(rec);
     Thread.Sleep(500);
     this._RobotManager.NextStep_Loader();
     Thread.Sleep(4000);
     //to 1///
     while (this._RobotManager.IsLoaderMoving())
     {
         Thread.Sleep(500);
     }
     Thread.Sleep(2000);
     this._Status = LoaderStatus.HOLDING;
     //this.closeClaw();
     //Thread.Sleep(5000);
     //this.robotManager.nextStep_Loader();
     ////to 2
     //while (this.robotManager.isLoaderMoving())
     //{
     //    Thread.Sleep(500);
     //}
     //Thread.Sleep(5000);
     //this.robotManager.nextStep_Loader();
     ////to 3
     //while (this.robotManager.isLoaderMoving())
     //{
     //    Thread.Sleep(500);
     //}
     //this.openClaw();
     //Thread.Sleep(5000);
     //this.robotManager.nextStep_Loader();
     ////to 4
     //while (this.robotManager.isLoaderMoving())
     //{
     //    Thread.Sleep(500);
     //}
     //Thread.Sleep(5000);
     //     this.robotManager.nextStep_Loader();
     return(MissionResult.NORMAL);
     // throw new NotImplementedException();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 开始异步进行预加载。
        ///
        /// 如果在进行执行Reset操作前,调用本方法多次,也只会执行一次loadAction。
        /// </summary>
        public void BeginLoading()
        {
            if (this.Status == LoaderStatus.NotStarted)
            {
                this.Status = LoaderStatus.Running;
                var version = this._version;

                ThreadPool.QueueUserWorkItem(o =>
                {
                    LoaderStatus status = LoaderStatus.NotStarted;
                    try
                    {
                        this._action();
                        status = LoaderStatus.Completed;

                        //触发事件。
                        if (this.ActionSucceeded != null)
                        {
                            this.ActionSucceeded(this, EventArgs.Empty);
                        }
                    }
                    catch
                    {
                        status = LoaderStatus.Failed;
                        throw;
                    }
                    finally
                    {
                        this._signal.Set();

                        //有可能外界已经使用Reset重设了状态,那么这次执行就算被“丢弃”了,不再设置值。
                        if (this._version == version)
                        {
                            this.Status = status;
                        }
                    }
                });
            }
        }
Ejemplo n.º 7
0
        public static string ToAppStateName(this LoaderStatus status)
        {
            switch (status)
            {
            case LoaderStatus.Ready:
                return("Не запущен");

            case LoaderStatus.Download:
                return("Загружает с Euromade.ru");

            case LoaderStatus.Upload:
                return("Загружает в базу данных");

            case LoaderStatus.Done:
                return("Работа выполнена");

            case LoaderStatus.Disconnected:
                return("Связь с EuroMade оборвана");

            default:
                return("Статус не определен");
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 重设本加载器,使得BeginLoading可以再次起作用。
 /// </summary>
 public void Reset()
 {
     this.Status = LoaderStatus.NotStarted;
     this._signal.Reset();
 }
Ejemplo n.º 9
0
 public MissionLoader(RobotManager robotManager)
 {
     // TODO: Complete member initialization
     this._RobotManager = robotManager;
     this._Status       = LoaderStatus.HOLDING;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 重设本加载器,使得BeginLoading可以再次起作用。
 /// </summary>
 public void Reset()
 {
     this.Status = LoaderStatus.NotStarted;
     this._signal.Reset();
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 开始异步进行预加载。
        /// 
        /// 如果在进行执行Reset操作前,调用本方法多次,也只会执行一次loadAction。
        /// </summary>
        public void BeginLoading()
        {
            if (this.Status == LoaderStatus.NotStarted)
            {
                this.Status = LoaderStatus.Running;
                var version = this._version;

                ThreadPool.QueueUserWorkItem(o =>
                {
                    LoaderStatus status = LoaderStatus.NotStarted;
                    try
                    {
                        this._action();
                        status = LoaderStatus.Completed;

                        //触发事件。
                        if (this.ActionSucceeded != null)
                        {
                            this.ActionSucceeded(this, EventArgs.Empty);
                        }
                    }
                    catch
                    {
                        status = LoaderStatus.Failed;
                        throw;
                    }
                    finally
                    {
                        this._signal.Set();

                        //有可能外界已经使用Reset重设了状态,那么这次执行就算被“丢弃”了,不再设置值。
                        if (this._version == version)
                        {
                            this.Status = status;
                        }
                    }
                });
            }
        }
Ejemplo n.º 12
0
 public void ResetState()
 {
     status   = LoaderStatus.Ready;
     Progress = string.Empty;
 }
Ejemplo n.º 13
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        networkManager = new NetworkManager();

        string[] args = System.Environment.GetCommandLineArgs();
        for (int i = 0; i < args.Length; i++)
        {
            if (args[i] == "-server")
            {
                loaderStatus = LoaderStatus.ServerBackground;
                DebugLog("Starting as server", GD.LT.Log);
                // ./UncivilizationLinux.x86_64 -server -batchmode -nographics -port 55601 -password olc
            }
            if (args[i] == "-port")
            {
                networkManager.SetPort(args[i + 1]);
                DebugLog("Listening port is: " + args[i + 1], GD.LT.Log);
            }
            if (args[i] == "-password")
            {
                networkManager.serverPassword = args[i + 1];
                DebugLog("Using password for server", GD.LT.Log);
            }
        }

        if (loaderStatus == LoaderStatus.ServerBackground)
        {
            networkManager.StartUpServer();
        }


        // Read the options
        fullScreen      = (FullScreenMode)PlayerPrefs.GetInt("FullScreen", 3);
        mainVolume      = PlayerPrefs.GetInt("MainVolume", 100);
        useTypingSound  = PlayerPrefs.GetInt("UseTypingSound", 1) != 0;
        writeLogsOnFile = PlayerPrefs.GetInt("WriteLogsOnFile", 1) != 0;
        logsLevel       = (LT)PlayerPrefs.GetInt("LogsLevel", (int)LT.Warning);
        filePathForLogs = PlayerPrefs.GetString("FilePathForLogs", Application.persistentDataPath);
        if (string.IsNullOrWhiteSpace(filePathForLogs))
        {
            filePathForLogs = "C:\\Users\\claud\\Unity\\Uncivilization\\Logs\\Server Logs\\";
        }

        logsLevel       = LT.DebugST; // FIXME remove after debugging
        writeLogsOnFile = true;       // FIXME

        AudioListener.volume  = mainVolume / 100f;
        Screen.fullScreenMode = fullScreen;
        Screen.fullScreen     = fullScreen != FullScreenMode.Windowed && fullScreen != FullScreenMode.Windowed;


        Debug.Log(filePathForLogs);

        // Init the log file
        InitLogFile();

        enemies = gameLoader.GetEnemies();
        gameLoader.InitGame();
    }
Ejemplo n.º 14
0
 public static bool IsStatus(LoaderStatus status1, LoaderStatus status2)
 {
     return(loaderStatus == status1 || loaderStatus == status2);
 }
Ejemplo n.º 15
0
 public static bool IsStatus(LoaderStatus status)
 {
     return(loaderStatus == status);
 }
Ejemplo n.º 16
0
 public static void SetStatus(LoaderStatus status)
 {
     loaderStatus = status;
     DebugLog("Status changed: " + loaderStatus, LT.Debug);
 }