Exemple #1
0
        static void Main(string[] args)
        {
            #region Instanciamento Singletons e Menus
            //Nota:A razão de instancionamento de singletons aqui é muito simples, não as proteji de multithreading, e program bootup so existe uma thread, aka, nunca instancia 2 vezes
            MQTTHandler        mqtt        = MQTTHandler.Instance;
            UserController     sqlUser     = UserController.Instance;
            SQLAssistant       sqlAss      = SQLAssistant.Instance;
            SensorController   sqlSensor   = SensorController.Instance;
            LocationController sqlLocation = LocationController.Instance;
            LoginController    sqlLogin    = LoginController.Instance;
            AlertController    sqlAlert    = AlertController.Instance;
            Menus          menu            = new Menus();
            DataController sqlData         = DataController.Instance;
            #endregion
            SQLAssistant.Instance.ReseedTable("t_generated_alerts");
            SQLAssistant.Instance.ReseedTable("t_alerts");



            while (true)
            {
                if (sqlLogin.isLogged)
                {
                    menu.MainMenu();
                }
                else
                {
                    menu.LoginMenu();
                }
            }
        }
Exemple #2
0
        public AlertControlViewModel(AlertController controller, eTaskType taskType)
        {
            this.TaskType       = taskType;
            this.Controller     = controller;
            this.ConnectCommand = new RelayCommand(p => this.Controller.OnConnect(), p => this.Controller.CanConnect());

            this.IssueCommand = new RelayCommand(p => this.Controller.OnIssue(), p => this.Controller.CanIssue());

            this.ReceiveCommand = new RelayCommand(p => this.Controller.OnReceive(), p => this.Controller.CanReceive());

            this.ChangeStatusCommand = new RelayCommand(p => this.Controller.OnChangeStatus(), p => this.Controller.CanChangeStatus());

            this.ResultCommand = new RelayCommand(p => OnViewResult());

            this.GroupSelectCommand = new RelayCommand(p => OnGroupSelect(), p => CanChangeGroup());

            if (this.TaskType == eTaskType.CTT)
            {
                this.FinishButtonCaption = "ĐÃ CTT";
            }
            else
            {
                this.FinishButtonCaption = "ĐÃ CC";
            }
        }
Exemple #3
0
        private static void ServerMessageReceived(PSMessage psMessage, bool isPusher)
        {
            if (!isPusher)
            {
                return;
            }
            if (psMessage.ActivityType == ActivityType.MembershipChanged && isPusher)
            {
                if (SingletonManager <UserManager> .Instance.user.Id == psMessage.ToUserId)
                {
                    Debug.LogWarning((object)"Membership Changed", (Object)null);
                    SingletonManager <UserManager> .Instance.user.AllianceMembership = AllianceManager.MembershipStringToEnum(psMessage.ActivityArgument);
                }
                if (SingletonManager <UserManager> .Instance.user.AllianceMembership == AllianceMembership.None)
                {
                    Debug.LogWarning((object)"Membership Reset", (Object)null);
                    SingletonManager <AllianceManager> .Instance.ResetCurrentAlliance();
                }
            }
            if (psMessage.ActivityType == ActivityType.DeviceLogin && !psMessage.ActivityArgument.Equals(UserManager.Md5Sum(SingletonManager <UserManager> .Instance.deviceKey)))
            {
                AlertController.ShowDisconnectPanel(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Disconnected"), psMessage.MessageString, SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Reload"));
            }
            if (psMessage.ActivityType != ActivityType.ModelUpdate || string.IsNullOrEmpty(psMessage.ActivityArgument))
            {
                return;
            }
            PSMainRoom room = SingletonManager <RoomManager> .Instance.ParseRoom <PSMainRoom>(Regex.Unescape(psMessage.ActivityArgument));

            SingletonManager <ShipManager> .Instance.PlayerShip.GetRoomByRoomId(room.RoomId).ConstructionStartDate = room.ConstructionStartDate;
        }
Exemple #4
0
        public AlertControllerUnitTest(ITestOutputHelper testOutputHelper)
        {
            _testOutputHelper = testOutputHelper;
            IAlertRepository service = new AlertRepository();

            _controller = new AlertController(service);
        }
Exemple #5
0
    private IEnumerator LoginRoutine(string username, string password, AlertController ac)
    {
        string escapedUsername = UnityWebRequest.EscapeURL(username);
        string escapedpassword = UnityWebRequest.EscapeURL(password);
        string phpURL          = baseURL + "username="******"&password="******"There was an error with UnityWebRequest");
            ac.CreateAlert("Login Failed", "Could not connect to server");
        }
        else if (uwrLogin.downloadHandler.text == "MySQL failed to execute")
        {
            ac.CreateAlert("Account Creation Failed", "Could not connect to server");
        }
        else if (uwrLogin.downloadHandler.text == "Email or password incorrect")
        {
            ac.CreateAlert("Login Failed", "Email or password incorrect");
        }

        // Assign the information to the player after a succesful Debug.LogWarning
        string[] items = uwrLogin.downloadHandler.text.Split(' ');  // Format: "username email ID"

        // Assign to the PlayerInfo script
        PlayerInfo playerInfo = GameObject.Find("Player Information").GetComponent <PlayerInfo>();

        playerInfo.userName = items[0];
        playerInfo.ID       = int.Parse(items[2]);
        playerInfo.currency = int.Parse(items[5]);
        playerInfo.level    = int.Parse(items[6]);


        while (true)
        {
            if (uwrLogin.isDone)
            {
                // check if the login was successful
                if (items[3] == "Successful")
                {
                    playerInfo.loggedIn = true;
                    success             = true;
                }
                else
                {
                    success             = false;
                    playerInfo.loggedIn = false;
                }

                done = true;
                Destroy(this);
                break;
            }
        }
    }
Exemple #6
0
        private void Awake()
        {
            _alert = GameObject.FindWithTag("Alert").GetComponent <AlertController>();
            var button = GetComponent <Button>();

            button.onClick.AddListener(OnClick);
            _gameState = Utils.FindNovaGameController().GetComponent <GameState>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AlertControllerTests"/> class.
 /// </summary>
 public AlertControllerTests()
 {
     Business.Dependencies.Register();
     this.alertManager = new Mock<IAlertManager>();
     this.personManager = new Mock<IPersonManager>();
     this.alertController = new AlertController(this.alertManager.Object, this.personManager.Object);
     CommonHelper.MockHttpRequestContext();
     SessionData.Instance.MasterData = CommonHelper.SetupMasterDataForUIControllers();
     DIContainer.Instance.Resolve<IComponentSettingsEntities>().MaxPageSize = 2;
 }
        public void GetAlerts()
        {
            AlertController         alertController = new AlertController(mockManagerTaskDataAccess.Object);
            ViewResult              result          = alertController.GetAlerts() as ViewResult;
            List <DriverCheckAlert> alerts          = result.Model as List <DriverCheckAlert>;

            alertController.Should().NotBeNull();
            result.Should().NotBeNull();
            alerts.Should().BeNull();
        }
Exemple #9
0
        public void ShowItemInfoPopup(ItemDesign itemDesign)
        {
            string str = string.Empty;

            if (itemDesign.EnhancementType != EnhancementType.None)
            {
                str = string.Format("\n<color=lime>{0} +{1:##.##}</color>", (object)Singleton <SharedManager> .Instance.GetEnhancementTypeShortString(itemDesign.EnhancementType), (object)itemDesign.EnhancementValue);
            }
            AlertController.ShowAlert(itemDesign.ItemDesignName, itemDesign.ItemDesignDescription + str, false, (Action)null, itemDesign.ImageSprite, (Action <bool>)null, string.Empty, (string)null, 0.0f);
        }
        public AlertOptionViewModel(AlertController controller) : base(controller)
        {
            this.A_Command  = new RelayCommand(p => this.Controller.ChangeTask(eTask.A));
            this.A2_Command = new RelayCommand(p => this.Controller.ChangeTask(eTask.A2));
            this.A3_Command = new RelayCommand(p => this.Controller.ChangeTask(eTask.A3));
            this.A4_Command = new RelayCommand(p => this.Controller.ChangeTask(eTask.A4));

            this.TC_Command = new RelayCommand(p => this.Controller.ChangeTaskLevel(eTaskLevel.TC));
            this.CA_Command = new RelayCommand(p => this.Controller.ChangeTaskLevel(eTaskLevel.CA));
            this.TB_Command = new RelayCommand(p => this.Controller.ChangeTaskLevel(eTaskLevel.TB));
        }
Exemple #11
0
 public static void ShowInsufficientStarbuxDialogue(int starbuxCost)
 {
     if (SingletonManager <Configuration> .Instance.ShouldHideBank)
     {
         AlertController.ShowAlert(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Not enough Starbux"), SingletonManager <LocalizationManager> .Instance.GetLocalizedText("You don't have enough Starbux to make this purchase."), true, (Action)null, (SpriteDesign)null, (Action <bool>)null, string.Empty, (string)null, 0.0f);
     }
     else
     {
         AlertController.ShowOptionPanel(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Not enough Starbux"), string.Format(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("You require {0} more Starbux for this purchase. Would you like to visit the Bank to buy more Starbux?"), (object)(starbuxCost - UserManager.Starbux)), (Action)(() => GameController.CurrentUIManager.OpenMenuPanel("BankMenuPanel", (Action <GameObject>)null)), (Action)null, 0.0f, false, string.Empty);
     }
 }
Exemple #12
0
 public static void ConvertStarbuxToSupplies(int amount, int starbuxCost, Action <PSServerMessage> endAction)
 {
     if (starbuxCost <= UserManager.Starbux)
     {
         AlertController.ShowWaitPanel(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Please wait..."));
         SingletonManager <UserManager> .Instance.BuySuppliesWithStarbux(amount, endAction, (Action)(() => AlertController.HideWaitPanel()));
     }
     else
     {
         SharedManager.ShowInsufficientStarbuxDialogue(starbuxCost);
     }
 }
Exemple #13
0
 public static void ConvertStarbuxToResources(PSItem item1, int amount1, PSItem item2, int amount2, int starbuxCost, Action <PSServerMessage> endAction)
 {
     if (starbuxCost <= UserManager.Starbux)
     {
         AlertController.ShowWaitPanel(SingletonManager <LocalizationManager> .Instance.GetLocalizedText("Please wait..."));
         SingletonManager <UserManager> .Instance.BuyItemsWithStarbux(item1.ItemDesignId, amount1, item2.ItemDesignId, amount2, endAction, (Action)(() => AlertController.HideWaitPanel()));
     }
     else
     {
         SharedManager.ShowInsufficientStarbuxDialogue(starbuxCost);
     }
 }
Exemple #14
0
    // Start is called before the first frame update
    void Start()
    {
        TutorialObjectTitle.GetComponent <Text>().text  = TutorialTitle;
        TutorialObjectRule.GetComponent <Text>().text   = TutorialRule;
        TutorialObjectHow.GetComponent <Text>().text    = TutorialHow;
        TutorialObjectReload.GetComponent <Text>().text = TutorialReload;

        AmmunationController = AmmoCounterPannel.GetComponent <AmmunationController>();
        alertController      = alert.GetComponent <AlertController>();
        grammar.ParseGramar();
        grammar.UpdateVisibleGramar();
        AmmunationController.GameEnable = false;
    }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AlertController     controller = new AlertController();
            AlertSelectCriteria criteria   = new AlertSelectCriteria();

            criteria.AlertLevelEnum.EqualTo(AlertLevelEnum.Critical);
            criteria.InsertTime.SortDesc(1);

            AlertsCount.Text = controller.GetAlertsCount(criteria).ToString();

            alerts = controller.GetAlerts(criteria);

            if (alerts.Count > 0)
            {
                int rows = 0;
                foreach (Alert alert in alerts)
                {
                    TableRow alertRow = new TableRow();

                    alertRow.Attributes.Add("class", "AlertTableCell");

                    TableCell component   = new TableCell();
                    TableCell source      = new TableCell();
                    TableCell description = new TableCell();

                    description.Wrap = false;

                    component.Text = alert.Component;
                    component.Wrap = false;
                    source.Text    = alert.Source;
                    source.Wrap    = false;

                    string content = alert.Content.GetElementsByTagName("Message").Item(0).InnerText;
                    description.Text  = content.Length < 50 ? content : content.Substring(0, 50);
                    description.Text += " ...";
                    description.Wrap  = false;

                    alertRow.Cells.Add(component);
                    alertRow.Cells.Add(source);
                    alertRow.Cells.Add(description);

                    AlertTable.Rows.Add(alertRow);

                    rows++;
                    if (rows == 5)
                    {
                        break;
                    }
                }
            }
        }
Exemple #16
0
    public void AdjustBroken(int broken)
    {
        this.broken = this.broken + broken;
        AlertController alerts = alertImage.gameObject.GetComponent <AlertController>();

        if (this.broken > 0)
        {
            alerts.ActivateAlert();
        }
        else if (this.broken < 1)
        {
            alerts.DeActivateAlert();
        }
    }
 public AlertControllerTest()
 {
     //mock setup
     alertMock  = new Mock <IAlert>();
     alertsMock = new List <IAlert> {
         alertMock.Object
     };
     alert        = new Alert();
     alerts       = new List <Alert>();
     alerthubMock = new Mock <AlertHub>();
     vehicle      = new Mock <Vehicle>();
     //controller setup
     _logger         = new Mock <ILogger <AlertController> >();
     repoMock        = new Mock <IRepositoryWrapper>();
     alertController = new AlertController(_logger.Object, repoMock.Object);
 }
Exemple #18
0
 public void StartHeartbeatCheck()
 {
     if (SingletonManager <Configuration> .Instance.TestMode && !(SingletonManager <Configuration> .Instance.ServerName == "Prod"))
     {
         return;
     }
     Debug.LogWarning((object)nameof(StartHeartbeatCheck), (Object)null);
     this.StopHeartbeatCheck();
     try
     {
         this.StartCoroutine(this.HeartbeatCheckTimer());
     }
     catch
     {
         AlertController.ShowDisconnectPanel("TRY LOG IN AGAIN", string.Empty, "RECONNECT");
     }
 }
    private IEnumerator CARoutine(string email, string username, string password, AlertController ac)
    {
        string escapedEmail    = UnityWebRequest.EscapeURL(email);
        string escapedUsername = UnityWebRequest.EscapeURL(username);
        string escapedpassword = UnityWebRequest.EscapeURL(password);
        string phpURL          = baseURL + "email=" + escapedEmail + "&username="******"&password="******"There was an error with UnityWebRequest");
            ac.CreateAlert("Account Creation Failed", "Could not connect to server");
        }
        else if (uwrCreateAccount.downloadHandler.text == "Invalid email address")
        {
            ac.CreateAlert("Account Creation Failed", "Email address is invalid!");
        }
        else if (uwrCreateAccount.downloadHandler.text == "Email already exists")
        {
            ac.CreateAlert("Account Creation Failed", "Email in use already!");
        }
        else if (uwrCreateAccount.downloadHandler.text == "Username already exists")
        {
            ac.CreateAlert("Account Creation Failed", "Username in use already!");
        }
        else if (uwrCreateAccount.downloadHandler.text == "MySQL failed to execute")
        {
            ac.CreateAlert("Account Creation Failed", "Could not connect to server");
        }

        while (true)
        {
            if (uwrCreateAccount.isDone)
            {
                done = true;
                //Debug.Log("Done");
                Destroy(this);
                break;
            }
        }
    }
 public AlertControllerTest()
 {
     _alertMock       = new Mock <IAlertService>();
     _alertController = new AlertController(_alertMock.Object);
     _alerts          = new List <Alert>()
     {
         new Alert()
         {
             Id = 1, Description = "Description1", Title = "Title1", IsDeleted = false
         },
         new Alert()
         {
             Id = 2, Description = "Description2", Title = "Title2", IsDeleted = true
         },
         new Alert()
         {
             Id = 3, Description = "Description3", Title = "Title3", IsDeleted = false
         }
     };
 }
        void DeleteAllConfirmDialog_Confirmed(object data)
        {
            AlertsGridPanel.RefreshCurrentPage();

            AlertController controller = new AlertController();

            AlertItemCollection items = AlertsGridPanel.AlertItems;

            bool successful = false;

            for (int i = 0; i < items.Count; i++)
            {
                successful = controller.DeleteAlert(items[i].TheAlertItem);
                if (!successful)
                {
                    break;
                }
            }

            if (successful)
            {
                Platform.Log(LogLevel.Info, "All Alert items deleted by user.");
            }
            else
            {
                Platform.Log(LogLevel.Error,
                             "PreResetConfirmDialog_Confirmed: Unable to delete all Alert items.");

                MessageBox.Message     = ErrorMessages.AlertDeleteFailed;
                MessageBox.MessageType =
                    MessageBox.MessageTypeEnum.ERROR;
                MessageBox.Show();
            }

            OnAllAlertsDeleted();
        }
Exemple #22
0
 // Use this for initialization
 void Start()
 {
     if (!isTestCard)
     {
         target = GameObject.Find("TargetPosition").transform;
         Sprite[] bigSprites   = Resources.LoadAll <Sprite>("Sprites/CardsElements");
         Sprite[] smallSprites = Resources.LoadAll <Sprite>("Sprites/SmallCardsElements");
         //Change Middle Rank Sprite
         if (rank == 1)
         {
             print("As string: " + ("A" + suit[0]));
             middleRankSprite.sprite = getSprite("A" + suit[0], bigSprites);
         }
         else
         {
             middleRankSprite.sprite = getSprite(rank.ToString(), bigSprites);
         }
         //Change Upper and bottom  suit
         upRankSprite.sprite     = getSprite(rank.ToString(), smallSprites);
         bottomRankSprite.sprite = getSprite(rank.ToString(), smallSprites);
         //Change Upper and bottom suit
         upSuitSprite.sprite     = getSprite(suit[0].ToString(), smallSprites);
         bottomSuitSprite.sprite = getSprite(suit[0].ToString(), smallSprites);
         //Change Diamonds and hearts to red
         if (suit[0] == 'H' || suit[0] == 'D')
         {
             upRankSprite.color     = Color.red;
             middleRankSprite.color = Color.red;
             bottomRankSprite.color = Color.red;
             upSuitSprite.color     = Color.red;
             bottomSuitSprite.color = Color.red;
         }
         //get CardController script reference
         alertController = GameObject.Find("AlertCanvas").GetComponent <AlertController>();
     }
 }
 public AlertOptionViewModelBase(AlertController controller)
 {
     this.Controller   = controller;
     this.SaveCommand  = new RelayCommand(p => this.Controller.CommitTaskChanges());
     this.ClearCommand = new RelayCommand(p => this.Controller.ClearTask());
 }
 void Awake()
 {
     m           = this;
     canvasGroup = GetComponent <CanvasGroup>();
 }
 public CCPK_AlertOptionViewModel(AlertController controller)
     : base(controller)
 {
     this.TC_Command = new RelayCommand(p => this.Controller.ChangeTaskLevel(eTaskLevel.TC));
     this.CA_Command = new RelayCommand(p => this.Controller.ChangeTaskLevel(eTaskLevel.CA));
 }
Exemple #26
0
        public AlertControllerTests()
        {
            IAlertRepository repository = new AlertRepository();

            _productsController = new AlertController(repository);
        }
Exemple #27
0
 public void BuyItemWithStarbux(int itemDesignId, int itemQuantity, Action <PSServerMessage> successAction, Action endAction = null)
 {
     AlertController.ShowServerLoadIcon();
     this.StartCoroutine(this.BuyItemWithStarbuxCoroutine(itemDesignId, itemQuantity, successAction, endAction));
 }
Exemple #28
0
 public AlertForm(AlertController controller)
 {
     this.controller = controller;
     InitializeComponent();
 }
Exemple #29
0
 void Awake()
 {
     instance = this;
     textMesh = textMeshObject.GetComponent <TextMeshProUGUI> ();
     imageGameObject.SetActive(false);
 }
Exemple #30
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AlertController alert = new AlertController();

            alert.submitAlert(new Alarm());
        }
Exemple #31
0
 private void InitAlerts()
 {
     SoundController.InitializeSoundFilesFromDirectory();
     AlertManager = new AlertController(_mainWindow, ItemsView);
 }