Inheritance: MonoBehaviour
Exemplo n.º 1
0
 public Mole(Random random, PopUp popUpCallback) {
     if (popUpCallback == null)
         throw new ArgumentException("popUpCallback can’t be null");
     this.random = random;
     this.popUpCallback = popUpCallback;
     hidden = true;
 }
Exemplo n.º 2
0
        public void SetParent(UIPanel ui, bool isLast = true, int index = -1)
        {
            switch (ui.layer)
            {
            case UILayer.BGBG:
                BGBG.SetChildWithIndex(ui.transform, !isLast ? index : BGBG.childCount);
                break;

            case UILayer.Background:
                Background.SetChildWithIndex(ui.transform, !isLast ? index : Background.childCount);
                break;

            case UILayer.AnimationUnderPage:
                AnimationUnderPage.SetChildWithIndex(ui.transform, !isLast ? index : AnimationUnderPage.childCount);
                break;

            case UILayer.Common:
                Common.SetChildWithIndex(ui.transform, !isLast ? index : Common.childCount);
                break;

            case UILayer.AnimationOnPage:
                AnimationOnPage.SetChildWithIndex(ui.transform, !isLast ? index : AnimationOnPage.childCount);
                break;

            case UILayer.PopUp:
                PopUp.SetChildWithIndex(ui.transform, !isLast ? index : PopUp.childCount);
                break;

            case UILayer.Guide:
                Guide.SetChildWithIndex(ui.transform, !isLast ? index : Guide.childCount);
                break;

            case UILayer.Toast:
                Toast.SetChildWithIndex(ui.transform, !isLast ? index : Toast.childCount);
                break;

            case UILayer.Top:
                Top.SetChildWithIndex(ui.transform, !isLast ? index : Top.childCount);
                break;

            case UILayer.TopTop:
                TopTop.SetChildWithIndex(ui.transform, !isLast ? index : TopTop.childCount);
                break;

            default:
                break;
            }
            ui.transform.LocalIdentity();
        }
Exemplo n.º 3
0
        //FOR EDITING
        private void EditRecord_Click(object sender, RoutedEventArgs e)
        {
            PopUp  p;
            Filter f = new Filter();
            // tracker.Track();
            // t_price.Text = tracker.TrackResult.Length.ToString();
            //CHECK EVERYTHING
            string item_name     = f.Trim(i_name_e.Text);
            string item_quantity = f.Trim(i_quantity_e.Text);
            string item_cost     = f.Trim(i_cost_e.Text);

            if (!(item_name == "" || item_quantity == "" || item_cost == ""))
            {
                //GOOD TO GO
                Query q = new Query();
                q.Get("items", "Where item_id = '" + i_id + "'");
                q.Record();
                string   current = DateTime.Now.ToString();
                string   editors = f.GetEditors("items", "item_id", q.Result[0]) + user_id + "," + f.Date(current, e_time_format);
                string[] val     = { item_name, item_cost, item_quantity, editors, "Now()" };
                q.successMessage = "Item " + q.Result[1] + " with id #" + i_id + " has been updated successfully!";
                q.Change("items", "item_name,item_cost,quantity_left,_editors,date_time_updated", val, "Where item_id = '" + i_id + "'");

                this.Frame.Opacity = 1;

                this.Frame.Navigate(typeof(Items), null);
            }

            else
            {
                if (item_name == "")
                {
                    p = new PopUp("Please enter the name of the item");
                }
                else if (item_cost == "")
                {
                    p = new PopUp("Please enter the price of the item");
                }
                else if (item_quantity == "")
                {
                    p = new PopUp("Please enter the quantity of the item.");
                }

                else
                {
                    p = new PopUp("Sorry, an error occured. The item couldn't be added. Please try again later");
                }
            }
        }
Exemplo n.º 4
0
    // Check if clover met any of ending conditions
    // If ending conditions are met, load EndingPopUp and reset clover
    public void CheckEnding()
    {
        int ending_number = 0;

        if (GetStat("water") <= 0)
        {
            //thirsty
            print("Died of thirst");
            ending_number = 1;
        }
        else if (GetStat("water") >= 100)
        {
            //drown
            print("Drown");
            ending_number = 2;
        }
        else if (GetStat("sun") <= 0)
        {
            //too cold
            print("Freezed");
            ending_number = 3;
        }
        else if (GetStat("sun") >= 100)
        {
            //too hot
            print("Dried");
            ending_number = 4;
        }
        else if (GetStat("level") == 6)
        {
            //survived successfully
            print("Congratulations!");
            ending_number = 5;
        }

        if (ending_number > 0)
        {
            //            EndingDirector.GetInstance().EndingFunctionOn(false); // random event ending off
            UpdateStats();
            WeatherFunctionOn(false); // weather change off
            CloverDirector.GetInstance().endingPopupOn = true;
            SetBugID(-1);             // bug timer off
            Debug.Log("Ending : " + ending_number);
            PopUp.GetInstance().FindText("Ending").text    = Collection.GetInstance().GetString("info", ending_number);
            PopUp.GetInstance().FindImage("Ending").sprite = Collection.GetInstance().GetImage(ending_number);
            PopUp.GetInstance().ShowPopUp("Ending", true);
            Collection.GetInstance().SetOpened(ending_number);
        }
    }
Exemplo n.º 5
0
    private void Hide_PopUp(Collision col)
    {
        hide = col.collider.GetComponent <Hide_Data>();
        Vector3 pos    = hide.HidePoint;
        Vector3 length = (pos - transform.position).normalized;

        if (hide.Cheak(length) && !GetHIDE_NOW())
        {
            pop = GetComponent <PopUp>();
            pop.SetText(" B:隠れる");//仮
            pop.Activate(120);
        }

        hide = null;
    }
Exemplo n.º 6
0
        /// <summary>
        /// Obsługuje zdarzenie kliknięcia w przycisk 'Wyjdź'. Obsługa polega na sprawdzeniu czy istnieje połączenie z urządzeniem Bluetooth.
        /// Zależnie od wyniku sprawdzenia wyświetlane jest odpowiednie pytanie. W przypadku, gdy wynik sprawdzenia jest pozytywny i użytkownik
        /// potwierdził zamknięcie aplikacji wywoływana jest metoda rozłączająca połączenie Bluetooth.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ButtonExit_Click(object sender, RoutedEventArgs e)
        {
            bool btConnected = Bluetooth.IsConnected;
            bool result      = await PopUp.ShowChoice(btConnected?StringConsts.ExitDialogTextWithBt : StringConsts.ExitDialogText, StringConsts.ExitDialogTitle, StringConsts.Yes, StringConsts.No);

            if (!result)
            {
                return;
            }
            if (btConnected)
            {
                Bluetooth.Disconnect();
            }
            Application.Current.Exit();
        }
    /*
     * public void DisableControll() {
     *  //player.Write(Converter.toString(Request.DISABLECONTROLLER) + time);
     *  player.EnableControll(false);
     * }
     */

    private void OnHealthValueChange(int value, int oldValue)
    {
        int delta = value - oldValue;

        player.OnShipValueChange(AttributeType.HEALTH, value);

        PopUp.ShowText(transform.position, delta.ToString(), 0, Color.white);

        if (value < 1)
        {
            ExplosionManager expManager = ObjectPool.Instance.Get <ExplosionManager>();
            expManager.Initialize(transform.position, 10);
            player.Death();
        }
    }
Exemplo n.º 8
0
        //add record click btn
        private void AddRecord_Click(object sender, RoutedEventArgs e)
        {
            //CHECK EVERYTHING
            PopUp  p;
            Filter f = new Filter();
            string report_content = f.Trim(r_content.Text);

            string report_name = f.Trim(r_name.Text);
            string report_test = f.Trim(r_tests.SelectedIndex.ToString());

            if (!(report_content == "" || (report_test == "" || report_test == "0") || report_name == ""))
            {
                //GOOD TO GO

                string[] r_t = f.Selected(r_tests.SelectedIndex, "Tests", null, 1);
                report_test = r_t[0];
                Query q = new Query();

                string[] val = { report_test, report_name, report_content, user_id, "Now()" };
                q.successMessage = "Report " + report_name + " has been added successfully!";
                q.Add("reports", val, "test_id,report_name,report,_added_by,date_time");


                this.Frame.Opacity = 1;

                this.Frame.Navigate(typeof(Reports), null);
            }

            else
            {
                if (report_content == "")
                {
                    p = new PopUp("Please say something about the report");
                }
                else if (report_name == "")
                {
                    p = new PopUp("Please give the report a name");
                }
                else if (report_test == "" || report_test == "0")
                {
                    p = new PopUp("Please select a test the report belongs to");
                }
                else
                {
                    p = new PopUp("Sorry, an error occured. The report couldn't be added. Please try again later");
                }
            }
        }
Exemplo n.º 9
0
        private void LogInBtn_Click(object sender, RoutedEventArgs e)
        {
            //CHECK IF THE NORMAL THINGS ARE OKAY
            if (username.Text.Trim() == "")
            {
                PopUp p = new PopUp("Your username field is empty");
            }
            if (pass.Password.Trim() == "")
            {
                PopUp p = new PopUp("Please input a password");
            }
            else
            {
                //CALL IN THE QUERY STUFF
                //Connection c = new Connection();
                // c.ChooseDb("stuff");

                Query q = new Query();

                q.Get("staffs", "WHERE username = '******' And password = '******' ");

                //set the count
                int count = 0;
                //while (q.reader.Read())
                //{
                //    user_token = Convert.ToInt32(q.reader[0]);
                //    count += 1;
                //}

                q.Records();
                while (count < q.CountRows())
                {
                    user_token = Convert.ToInt32(q.Results[0, 0]);
                    count     += 1;
                }

                if (count > 0)//CHECK IF THE LOGIN DETAILS ARE VALID
                {
                    (App.Current as App).User_token = user_token;
                    this.Frame.Navigate(typeof(Home), null);
                }

                else
                {
                    PopUp p = new PopUp("Incorrect username and password combination.");
                }
            }
        }
Exemplo n.º 10
0
        public Breakable(Vector2 position)
        {
            Position = position;
            Texture  = Game.Assets.Env.Box_01;

            int rand = Helper.Rand.Next(3);

            if (rand == 0)
            {
                Scale      = Texture.CreateScale(42);
                scaleOnHit = Texture.CreateScale(58);
            }
            else if (rand == 1)
            {
                Scale      = Texture.CreateScale(42, 32);
                scaleOnHit = Texture.CreateScale(58, 44);
            }
            else if (rand == 2)
            {
                Scale      = Texture.CreateScale(40, 50);
                scaleOnHit = Texture.CreateScale(50, 60);
            }
            initialScale  = Scale;
            destroyEffect = new ParticleSystem(Position, Vector2.One, new ParticleSystemSettings()
            {
                Density       = 0.3f,
                Lifetime      = new Size(0.4f, 0.8f),
                Size          = new Size(1f, 1.5f),
                Speed         = new Size(100, 200),
                Texture       = Game.Assets.PixelatedCircle,
                OneTime       = true,
                DecreaseSize  = true,
                DecreaseAlpha = true,
                Colors        = new List <Color>()
                {
                    new Color(185, 127, 86),
                    new Color(124, 78, 46),
                    new Color(153, 100, 62)
                },
                SpawnInCircle = true,
                CircleRadius  = Rectangle.Width / 2,
                Burst         = true,
                BurstSize     = 10,
            });
            popUp       = new PopUp(Position, Vector2.One, Helper.SquareTexture, 0.75f);
            Color       = Helper.Rand.Next(2) == 1 ? Color.Black : Color.White;
            HasCollider = true;
        }
Exemplo n.º 11
0
    public void CreatePopUp(int index, string message)
    {
        PopUp preFab = PopUps[index];

        System.Type type = preFab.GetType();
        if (activePopUp == null || activePopUp.GetType() != type)
        {
            if (activePopUp != null)
            {
                activePopUp.Destroy();
            }
            activePopUp = Instantiate(preFab, gameObject.transform, false);
            activePopUp.Setup();
            StartCoroutine(activePopUp.StartPopUp(message));
        }
    }
        private async void AbriGaleria()
        {
            var response = await Camara.AbriGaleria();

            if (response.Exito)
            {
                string dataFoto = response.Data.ToString();
                Foto = Converter.ConvertBase64ToImageSource(dataFoto);
                EnviarImagen();
                await PopUp.PopAllPopUps();
            }
            else
            {
                await PopUp.PushPopUp(PopUpKeys.Mensaje, response.Mensaje);
            }
        }
Exemplo n.º 13
0
 // on tutorial next button click, if tutorial script is not last line, load next line of script
 public void OnTutorialNextButtonClick()
 {
     buttonClick = GameObject.Find("ButtonClickSound").GetComponent <AudioSource>();
     buttonClick.Play();
     Debug.Log("Tutorial Next button clicked!");
     if (currentLine < this.length - 1)
     {
         string T_mark = "<Text>";
         currentLine += 1;
         PopUp.GetInstance().FindText("Tutorial").text = tutorialScripts[currentLine].Substring(T_mark.Length);
     }
     else
     {
         Debug.Log("Can't get next script");
     }
 }
Exemplo n.º 14
0
    private void AdvanceQuestAfterConversation(ActiveQuestBase q)
    {
        q.CleanUp();

        if (q.NextQuest == null)
        {
            PopUp.SetPopUp(
                "You finished the quest! You may either continue in this area or switch quests using the quest book on your screen.",
                new[] { "ok" }, new Action[] {
                () => { }
            });
            return;
        }

        SetCurrentQuest(q.NextQuest);
    }
    void Awake()
    {
        _previousPages = new Stack <GameObject>();

        _profilePage      = MainContentPanel.transform.FindChild("ProfilePage").gameObject;
        _avalibleTaskPage = MainContentPanel.transform.FindChild("Available Tasks").gameObject;
        _activeTasksPage  = MainContentPanel.transform.FindChild("Active Tasks").gameObject;
        _settingsPage     = MainContentPanel.transform.FindChild("MenuPanel").gameObject;
        _specificTaskPage = MainContentPanel.transform.FindChild("Specific Task View").gameObject;
        _leaderBoardPage  = MainContentPanel.transform.FindChild("LeaderBoard").gameObject;


        _popupScript = PopUpGameObject.GetComponent <PopUp> ();

        PopUpGameObject.SetActive(true);
        PopUpGameObject.SetActive(false);
    }
Exemplo n.º 16
0
        /// <summary>
        /// Starts a Process.
        /// </summary>
        /// <param name="processInfo">butler process infos</param>
        /// <returns>butler information</returns>
        private string StartProcess(ProcessStartInfo processInfo)
        {
            var result = "";

            using (var process = Process.Start(processInfo))
            {
                using (var reader = process?.StandardOutput)
                {
                    result += reader?.ReadToEnd();
                }
            }


            PopUp.Info("Itch.Io Upload Completed.", "Info!", true);

            return(result);
        }
Exemplo n.º 17
0
 // Update is called once per frame
 void Update()
 {
     if ((Balloon.GetComponent <TalkBalloon> ().NumberOfTalk() >= NeedTalkCount))
     {
         ShopItem1.GetComponent <Button> ().enabled  = true;
         buyButton1.GetComponent <Button> ().enabled = true;
         QuestionBox1.SetActive(false);
         if (!IsAlreadyOpen)
         {
             PopUpText.text = "이제 상점에서 " + ItemName1 + " 구입할 수 있습니다!";
             PopUpClose.SetActive(true);
             PopUp.SetActive(true);
             IsAlreadyOpen = true;
         }
     }
     save();
 }
Exemplo n.º 18
0
    /// <summary>
    /// Create a prefabs in 2D environment, the name is the same as the one he has in the file.
    /// </summary>
    public GameObject CreatePrefab(string nameObj, Vector2 size, Vector2 pos, float duration, string animName = null)
    {
        GameObject go    = Instantiate(prefabs[nameObj] as GameObject, canvas);
        PopUp      popUp = go.GetComponent <PopUp>();

        popUp.transform.localPosition = new Vector3(pos.x, pos.y, 0);
        ((RectTransform)popUp.transform).sizeDelta = size;
        popUp.timer = duration;
        if (animName != null)
        {
            popUp.animator.Play(animName);
        }

        popUpList.Add(go);

        return(go);
    }
Exemplo n.º 19
0
    protected override void OnMouseOver()
    {
        if (GameManager.isPaused)
        {
            return;
        }
        if (GameManager.ActualDrag)
        {
            return;
        }

        string message = "Polution: +" + polutionEngendrée.ToString() + " %" + System.Environment.NewLine + System.Environment.NewLine +
                         "Poubelle: " + PoubelleAffilié.ToString() + System.Environment.NewLine + System.Environment.NewLine +
                         Description;

        PopUp.Show(Nom, message);
    }
Exemplo n.º 20
0
 // Update is called once per frame
 void Update()
 {
     if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
     {
         ShopItem.GetComponent <Button> ().enabled  = true;
         buyButton.GetComponent <Button> ().enabled = true;
         QuestionBox.SetActive(false);
         if (!IsAlreadyOpen)
         {
             PopUpText.text = "이제 상점에서 <머그컵 세트>를 구입할 수 있습니다!";
             PopUpClose.SetActive(true);
             PopUp.SetActive(true);
             IsAlreadyOpen = true;
         }
     }
     save();
 }
Exemplo n.º 21
0
 /// <summary>
 /// Cette fonction permet de valider
 /// le pseudo via la touche entrée plutot
 /// que de cliquer sur valider
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void keyEnterDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         name = champPseudo.Text;
         if (name.Length >= 10 || name.Length <= 0)
         {
             PopUp pu = new PopUp();
             pu.setErreur("Le pseudo ne fait pas la bonne taille");
             pu.ShowDialog();
         }
         else
         {
             this.Close();
         }
     }
 }
    private void OnShieldValueChange(int value, int oldValue)
    {
        int delta = value - oldValue;

        player.OnShipValueChange(AttributeType.SHIELD, value);

        PopUp.ShowText(transform.position, delta.ToString(), 0, Color.cyan);

        if (value < 1)
        {
            shieldSprite.enabled = false;
        }
        else
        {
            shieldSprite.enabled = true;
        }
    }
Exemplo n.º 23
0
    /// <summary>
    /// Create a permanent prefabs in 3D environment that FOLLOW THE CAMERA, the name is the same as the one he has in the file.
    /// </summary>
    public GameObject CreatePrefab3D(string nameObj, Vector2 scale, Vector3 pos, Transform parent, string animName = null)
    {
        GameObject go    = Instantiate(prefabs[nameObj] as GameObject, parent);
        PopUp      popUp = go.GetComponent <PopUp>();

        popUp.transform.localPosition = pos;
        popUp.followCam = true;
        popUp.hasTimer  = false;
        if (animName != null)
        {
            popUp.animator.Play(animName);
        }

        popUpList.Add(go);

        return(go);
    }
Exemplo n.º 24
0
    /// <summary>
    /// Create a temporary prefabs in 3D environment that DON'T FOLLOW THE CAMERA, the name is the same as the one he has in the file.
    /// </summary>
    public GameObject CreatePrefab3D(string nameObj, Vector2 scale, Vector3 pos, Quaternion rota, Transform parent, float duration, string animName = null)
    {
        GameObject go    = Instantiate(prefabs[nameObj] as GameObject, parent);
        PopUp      popUp = go.GetComponent <PopUp>();

        popUp.transform.localPosition = pos;
        popUp.transform.localRotation = rota;
        popUp.timer = duration;
        if (animName != null)
        {
            popUp.animator.Play(animName);
        }

        popUpList.Add(go);

        return(go);
    }
Exemplo n.º 25
0
    protected override void OnMouseOver()
    {
        if (GameManager.isPaused)
        {
            return;
        }
        if (isDestroyed)
        {
            return;
        }

        string message = "Temps: +" + SatisfactionGénérée.ToString() + " s" + System.Environment.NewLine + System.Environment.NewLine +
                         "Prix: " + Prix.ToString("0.00") + " €" + System.Environment.NewLine + System.Environment.NewLine +
                         Description;

        PopUp.Show(Nom, message);
    }
Exemplo n.º 26
0
        public TestWindowModel(PopUp model, IWindowService openWindowService)
        {
            Model                 = model;
            BlockVolume           = SetBlockVolume();
            NewWordsCounter       = BlockVolume;
            InitialFillTestIndex  = 0;
            FillTestIndex         = 0;
            TestAppearCounter     = 0;
            IsDictionaryCompleted = false;
            //IsNewWord = true;
            PriorityReduсtionCounter   = 0;
            DictionaryRefreshCounter   = BlockVolume;
            DictionaryRefreshIndex     = BlockVolume;
            NextWordCounter            = 0;
            NewWordsAmount             = 0;
            FillTestNextWordIndex      = BlockVolume;
            TranslationClickCanExecute = true;
            CorrectAnswersCounter      = 0;
            IncorrectAnswersCounter    = 0;

            if (Model.IsTestOpenFirstly)
            {
                IsCountersVisible      = true;
                CurrentWordsDictionary = new Dictionary <string, double>();
                TermList        = Model.GetTermList();
                TranslationList = Model.GetTranslationList();
            }
            else
            {
                CurrentWordsDictionary = Model.GetCurrentWordsDictionary(BlockVolume);
                TermList        = Model.GetCurrentTermList(BlockVolume);
                TranslationList = Model.GetCurrentTranslationList(BlockVolume);
            }

            VariantsList = new List <Dictionary <string, bool> >();
            AnswerList   = new List <Dictionary <string, bool> >();

            InitialFillTest();
            this.openWindowService  = openWindowService;
            TranslationOneColor     = Color.FromArgb(255, 0, 0, 0);
            TranslationTwoColor     = Color.FromArgb(255, 0, 0, 0);
            TranslationThreeColor   = Color.FromArgb(255, 0, 0, 0);
            TranslationFourColor    = Color.FromArgb(255, 0, 0, 0);
            TranslationClickCommand = new RelayCommand(TranslationClickCommand_Execute, TranslationClickCommand_CanExecute);
        }
Exemplo n.º 27
0
        //add record click btn
        private void AddRecord_Click(object sender, RoutedEventArgs e)
        {
            //CHECK EVERYTHING
            PopUp  p;
            Filter f             = new Filter();
            string item_name     = f.Trim(i_name.Text);
            string item_quantity = f.Trim(i_quantity.Text);
            string item_cost     = f.Trim(i_cost.Text);

            if (!(item_name == "" || item_quantity == "" || item_cost == ""))
            {
                //GOOD TO GO
                Query q = new Query();


                string[] val = { item_name, item_cost, item_quantity, user_id, "Now()" };
                q.successMessage = "Item " + item_name + " has been added successfully!";
                q.Add("items", val, "item_name,item_cost,quantity_left,_added_by,date_time");

                this.Frame.Opacity = 1;

                this.Frame.Navigate(typeof(Items), null);
            }

            else
            {
                if (item_name == "")
                {
                    p = new PopUp("Please enter the name of the item");
                }
                else if (item_cost == "")
                {
                    p = new PopUp("Please enter the price of the item");
                }
                else if (item_quantity == "")
                {
                    p = new PopUp("Please enter the quantity of the item.");
                }

                else
                {
                    p = new PopUp("Sorry, an error occured. The item couldn't be added. Please try again later");
                }
            }
        }
Exemplo n.º 28
0
        //List<double> PriorityList { get; set; }
        //int HighPriorityCounter { get; set; }
        //int MiddlePriorityCounter { get; set; }
        //int LowPriorityCounter { get; set; }
        // /Test-related data

        public PopUpWindowModel(PopUp model, IWindowService windowService, IConfigProvider configProvider)
        {
            Model               = model;
            WordsDictionary     = Model.GetWordsDictionary();
            this.windowService  = windowService;
            this.configProvider = configProvider;

            PopUpMode         = this.configProvider.PopUpMode;
            CurrentRecord     = 0;
            DefaultModeOffset = false;
            //PriorityList = new List<double>();
            //IterationsCounter = 0;
            //HighPriorityCounter = 0;
            //MiddlePriorityCounter = 0;
            //LowPriorityCounter = 0;

            ChangeWindowContent();

            TermFontType         = StaticConfigProvider.TermFontType;
            TranslationFontType  = StaticConfigProvider.TranslationFontType;
            TermFontSize         = StaticConfigProvider.TermFontSize;
            TranslationFontSize  = StaticConfigProvider.TranslationFontSize;
            TermFontStyle        = StaticConfigProvider.TermFontStyle;
            TranslationFontStyle = StaticConfigProvider.TranslationFontStyle;

            PopUp.StaticPropertyChanged += Model_PropertyChanged;
            StaticConfigProvider.StaticPropertyChanged += StaticConfigProvider_PropertyChanged;
            ConfigProvider.StaticPropertyChanged       += ConfigProvider_PropertyChanged;

            SecondsToOpen     = StaticConfigProvider.SecondsToOpen + (int)StaticConfigProvider.DelayMilliSeconds;
            DelayMilliSeconds = (int)StaticConfigProvider.DelayMilliSeconds * 1000;
            openWindowTimer   = new DispatcherTimer();

            if (PopUpMode != "default")
            {
                openWindowTimer.Interval = TimeSpan.FromSeconds(SecondsToOpen);
            }
            else
            {
                openWindowTimer.Interval = TimeSpan.FromSeconds(DelayMilliSeconds / 1000);
            }

            openWindowTimer.Tick += OpenWindow_Timer_Tick;
            openWindowTimer.Start();
        }
Exemplo n.º 29
0
        private void ComboMediaFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_cmbFilesList.SelectedItem is MediaFileInfo info)
            {
                if (info != null && !string.IsNullOrWhiteSpace(info.FileName))
                {
Retry:
                    if (!File.Exists(info.FileName))
                    {
                        var res = PopUp.MessageBox("File Not Found: \n" + info.FileName, "Open Media File",
                                                   MessageBoxImage.Exclamation, TextAlignment.Left,
                                                   new PopUp.PopUpButtons("_Skip to Next", "Re_move & Next", "Re_try", PopUp.PopUpResult.Btn3));

                        if (res == PopUp.PopUpResult.Btn3)
                        {
                            goto Retry;
                        }

                        ePlayMode playMode = MediaDB.SelectedPlayList.PlayMode;
                        bool      bResetPositionAndPlayNext = false;
                        if (playMode == ePlayMode.PlayAll || playMode == ePlayMode.RepeatAll)
                        {
                            bResetPositionAndPlayNext = true;
                        }

                        bool bRemoveFromList = (res == PopUp.PopUpResult.Btn2);

                        RemoveMediaFileAndSelectNext(info, bResetPositionAndPlayNext, bRemoveFromList);
                        return;
                    }

                    MediaDB.SelectedMediaFileIndex = _cmbFilesList.SelectedIndex;

                    PlayerVM.Open(info);
                }
                else
                {
                    PlayerVM.SaveAndClear();
                }
            }
            else
            {
                PlayerVM.SaveAndClear();
            }
        }
Exemplo n.º 30
0
        private void LoadFromString(string loadText)
        {
            string     errorMessage = "Could not load the following:\n";
            bool       error        = false;
            SaveObject saveData     = JsonUtility.FromJson <SaveObject>(loadText);

            foreach (KeyValuePairStringString kvp in saveData.VariableDictionary)
            {
                ListObject soToOverwrite = ObjectsToSave.FirstOrDefault(so => so.ObjectToSave.name.Equals(kvp.Key));

                if (soToOverwrite == null)
                {
                    if (kvp.Key.Equals("Time"))
                    {
                        LastTimePlayedUTC = DateTime.Parse(kvp.Value, null, DateTimeStyles.RoundtripKind);
                        continue;
                    }
                    // Removed a variable?
                    Debug.LogWarning("Could not find scriptable object matching name: " + kvp.Key);
                    continue;
                }

                try {
                    if (soToOverwrite.OtherData.Count == 0)
                    {
                        ((ISaveable)soToOverwrite.ObjectToSave).SetData(kvp.Value);
                    }
                    else
                    {
                        ((ISaveable)soToOverwrite.ObjectToSave).SetData(kvp.Value, soToOverwrite.OtherData[0]);
                    }
                }
                catch (Exception e) {
                    Debug.LogWarning(e.Message + "\n" + e.StackTrace);
                    errorMessage += $"<b>{soToOverwrite.ObjectToSave.name}\n{e.Message}\n{e.StackTrace}</b>\n";
                    error         = true;
                }
            }

            if (error)
            {
                PopUp.SetPopUp(errorMessage, new[] { "Ok", "Close Game" },
                               new Action[] { () => { }, () => Application.Quit() });
            }
        }
Exemplo n.º 31
0
 //Depending in which state the game is do specific update tasks
 void Update()
 {
     if (state == GameCycle.Preparation)
     {
         if (prepStarted)
         {
             CalcFogMask_Prep();
             PopUp.SpawnPopUp(popUp, "Place your units!", 1f, Color.yellow);
         }
         prepStarted = false;
         Update_Preparation();
     }
     if (state == GameCycle.Play)
     {
         //Game ends
         if (UnitManager.enemies.Count == 0)
         {
             print("Allies won!");
             state = GameCycle.End;
         }
         else if (UnitManager.allies.Count == 0)
         {
             print("Enemies won!");
             state = GameCycle.End;
         }
         else if (UnitManager.allyShogun.isDead)
         {
             print("Enemies won!");
             state = GameCycle.End;
         }
         else if (UnitManager.enemyShogun.isDead)
         {
             print("Allies won!");
             state = GameCycle.End;
         }
         if (state != GameCycle.End)
         {
             Update_Play();
         }
     }
     if (state == GameCycle.End)
     {
         Update_End();
     }
 }
Exemplo n.º 32
0
 private void Awake() { instance = this; }
Exemplo n.º 33
0
    // Use this for initialization
    public void Setup(LevelManager _lev)
    {
        levMan = _lev;

        NotifPop = FETool.findWithinChildren(gameObject ,"Ingame/Panels/NotifObj").GetComponent<PopUp>();
        NotifPop.Setup();
        NotifPop.Fade();

        HandClock = FETool.findWithinChildren(gameObject, "Ingame/Panels/Clock/Aiguille").GetComponentInChildren<OTSprite>();
        FoodState = FETool.findWithinChildren(gameObject, "Ingame/Panels/PanFood/Bar").GetComponentInChildren<OTSprite>();
        SleepState = FETool.findWithinChildren(gameObject, "Ingame/Panels/PanSleep/Bar").GetComponentInChildren<OTSprite>();
        Controls = FETool.findWithinChildren(gameObject, "Ingame/Controls").GetComponentInChildren<OTSprite>();

        dialogPop = FETool.findWithinChildren(gameObject, "Ingame/Dialog").GetComponent<PopUp>();
        WillBack = FETool.findWithinChildren(gameObject, "Ingame/Dialog/WillBeBack").GetComponentInChildren<OTSprite>();
        WillBackTxt = FETool.findWithinChildren(gameObject, "Ingame/Dialog/WillBeBack").GetComponentInChildren<TextUI>();
        OtherText = FETool.findWithinChildren(gameObject, "Ingame/Dialog/OtherText").GetComponentInChildren<TextUI>();
        dialogPop.Setup();

        VictoryGO = FETool.findWithinChildren(gameObject, "Ingame/Victory");
        DeathGO = FETool.findWithinChildren(gameObject, "Ingame/Death");
        StartGO = FETool.findWithinChildren(gameObject, "Ingame/Start");
        TitleGO = FETool.findWithinChildren(gameObject, "Ingame/Title");

        StartCoroutine("fadeControls");
        //		dialogPop.Fade();

        Paper = FETool.findWithinChildren(gameObject, "Ingame/Paper/SeekPaper").GetComponentInChildren<OTSprite>();
        paperText = FETool.findWithinChildren(gameObject, "Ingame/Paper/State").GetComponentInChildren<TextUI>();

        Clock = FETool.findWithinChildren(gameObject, "Ingame/Panels/Clock/Hours").GetComponent<TextUI>();
        DarkBG = FETool.findWithinChildren(gameObject, "Ingame/Black").GetComponentInChildren<OTSprite>();

        UIBtn[] listBtn = GetComponentsInChildren<UIBtn>();
        foreach ( UIBtn btn in listBtn)
        {
            btn.Setup(this);
        }

        GameEventManager.GameOver += GameOver;
        GameEventManager.Respawn += Respawn;
        GameEventManager.GameStart += GameStart;
        GameEventManager.EndGame += EndGame;
    }
Exemplo n.º 34
0
 public void discoverCharacter(PopUp.CharList _char)
 {
     if ( _char == PopUp.CharList.Dracula)
     {
         dialogPop.DraculaPic.frameName = "portrait_dracula";
         OtherText.text = "Dracula";
     }
     else if (_char == PopUp.CharList.MailMan)
     {
         dialogPop.DraculaPic.frameName = "portrait_mailman";
         OtherText.text = "MailMan";
     }
 }