Пример #1
0
    protected IEnumerator MoveCoroutine(IEnumerator move)
    {
        ShouldAllowInput = false;
        Deselect();
        yield return(StartCoroutine(move));

        yield return(AIController.TakeAITurn());

        ShouldAllowInput = true;
        var overType = RulesChecker.IsLevelOver();

        switch (overType)
        {
        case GameOverStatus.NotOver:
            OnSelectionMade();
            break;

        case GameOverStatus.Win:
            yield return(new WaitForSeconds(0.5f));

            yield return(GameOverController.Win());

            yield return(LevelController.Get.WinLevel());

            break;

        case GameOverStatus.Lose_MultipleDied:
            yield return(new WaitForSeconds(0.5f));

            yield return(GameOverController.LoseMultiDeath());

            yield return(LevelController.Get.LoseLevel());

            break;

        case GameOverStatus.Lose_EnemiesSurvived:
            yield return(new WaitForSeconds(0.5f));

            yield return(GameOverController.LoseEnemySurvived());

            yield return(LevelController.Get.LoseLevel());

            break;

        case GameOverStatus.Lose_NoDeaths:
            yield return(new WaitForSeconds(0.5f));

            yield return(GameOverController.LoseNoDeaths());

            yield return(LevelController.Get.LoseLevel());

            break;
        }
    }
Пример #2
0
        /// <summary>
        ///     Send to print labels to an available printer and save in the sytem
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public String PrintLabel(String data)//String objid, String quantity, String location)
        {
            JArray jsondata = new JArray();

            try
            {
                jsondata = JsonConvert.DeserializeObject <JArray>(data);
            }
            catch (Exception ex) { return(null); }
            String  cadena = "";
            String  tipo   = "";
            JObject objcad = new JObject();

            foreach (JObject row in jsondata)
            {
                int    labels   = 0;
                int    quant    = 0;
                String objid    = "";
                String objname  = "";
                String quantity = "";
                String location = "";
                String userid   = "";
                try { objid = row["objid"].ToString(); }
                catch (Exception ex) { }
                try { objname = row["objname"].ToString(); }
                catch (Exception ex) { }
                try { location = row["location"].ToString(); }
                catch (Exception ex) { }
                try { quantity = row["quantity"].ToString(); }
                catch (Exception ex) { }
                try { userid = row["userid"].ToString(); }
                catch (Exception ex) { }
                try
                {
                    quant = Int16.Parse(quantity);
                }
                catch (Exception e) { }

                if (quant > 0 && objid != null && objid != "" && objid != "null")
                {
                    // Try to send the information to the WebService
                    try
                    {
                        autobuildHTK_client.Rivka.Api.PrintServiceClient PrintService = new autobuildHTK_client.Rivka.Api.PrintServiceClient();

                        string availablePrinter = "";
                        //  Checks if there is an available printer
                        try
                        {
                            availablePrinter = PrintService.GetPrinter();
                            if (availablePrinter != null && availablePrinter != "")
                            {
                                String  newEPC   = "";
                                JObject obj      = new JObject();
                                bool    conected = PrintService.Connect(availablePrinter);
                                bool    oLabel   = PrintService.OpenLabel();

                                //Generate new EPCs
                                newEPC = objectTable.getEPC(objid, quantity);
                                obj    = JsonConvert.DeserializeObject <JObject>(newEPC);
                                string nextEPC = obj["nextEPC"].ToString();

                                bool sEPC = PrintService.SetEPC(nextEPC);

                                int.TryParse(obj["quantity"].ToString(), out labels);
                                bool print = PrintService.Print(availablePrinter, labels);

                                PrintService.Disconnect(availablePrinter);
                                PrintService.Close();

                                if (print == true)
                                {
                                    saveObjects(objid, location, userid, objname, labels, obj["nextEPC"].ToString());
                                    if (labels != quant)
                                    {
                                        cadena = "Enviado. Solo se imprimieron " + labels.ToString() + " etiquetas.";
                                        tipo   = "warning";
                                    }
                                    else
                                    {
                                        cadena = "Enviado Satisfactoriamente";
                                        tipo   = "success";
                                    }
                                    bool ok = true;
                                    try
                                    {
                                        ok = RulesChecker.isValidToLocation(objid, location);
                                    }
                                    catch (Exception e) { }
                                    if (ok == false)
                                    {
                                        classNotifications.saveNotification("Rules", "Invalid", "Objetos se han movido a Ubicacion no valida");
                                        // return "problem";
                                    }
                                }
                                else
                                {
                                    cadena = "Error en la Impresión";
                                    tipo   = "error";
                                }
                            }
                            else
                            {
                                cadena = "No Impresora Encontrada";
                                tipo   = "error";
                            }
                        }
                        catch (Exception e)
                        {
                            tipo   = "error";
                            cadena = "No Impresora Encontrada";
                        }
                    }
                    catch (Exception e)
                    {
                        tipo   = "error";
                        cadena = "Error de comunicación, Intente nuevamente";
                    }
                }
                else
                {
                    tipo   = "error";
                    cadena = "Datos Incorrectos";
                }
            }

            objcad["cadena"] = cadena;
            objcad["tipo"]   = tipo;

            return(JsonConvert.SerializeObject(objcad));
        }