Beispiel #1
0
        public override void HandleNotification(INotification notification)
        {
            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            switch (notification.Name)
            {
            case Notification.ColdTheme:
            {
                gloalData.ThemeIndex = 1;
                for (int i = 0; i < GetStorePanel.itemComponents.Count; i++)
                {
                    GetStorePanel.itemComponents[i].ChangeTheme();
                }
                break;
            }

            case Notification.WarmTheme:
            {
                gloalData.ThemeIndex = 2;
                for (int i = 0; i < GetStorePanel.itemComponents.Count; i++)
                {
                    GetStorePanel.itemComponents[i].ChangeTheme();
                }
                break;
            }

            default:
                break;
            }
        }
        protected override void InitDataAndSetComponentState()
        {
            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            if (gloalData.ThemeIndex == 1)
            {
                coldThemeToggle.isOn = true;
            }
            else
            {
                warmThemeToggle.isOn = true;
            }

            if (gloalData.BoyOrGirl == 0)
            {
                girl.SetActive(true);
                boy.SetActive(false);
            }
            else
            {
                girl.SetActive(false);
                boy.SetActive(true);
            }
        }
Beispiel #3
0
        public override void Execute(INotification notification)
        {
            base.Execute(notification);

            Data data = notification.Body as Data;

            if (data == null)
            {
                return;
            }

            GlobalDataProxy globalDataProxy = (GlobalDataProxy)ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME);

            globalDataProxy.CostCup(data.currencyType, data.costCupNumber);
            GlobalData GlobalData = globalDataProxy.GetGlobalData;

            switch (data.currencyType)
            {
            case CurrencyType.Gold:
                ApplicationFacade.Instance.SendNotification(Notification.ChangeGlodCup, GlobalData.GoldCup);
                break;

            case CurrencyType.Silver:
                ApplicationFacade.Instance.SendNotification(Notification.ChangeSilverCup, GlobalData.SilverCup);
                break;

            case CurrencyType.Bronze:
                ApplicationFacade.Instance.SendNotification(Notification.ChangeBronzeCup, GlobalData.BronzeCup);
                break;
            }
        }
Beispiel #4
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         GlobalDataProxy globalDataProxy = (GlobalDataProxy)ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME);
         globalDataProxy.SerializeData();
         this.Log("按键1");
     }
 }
        protected override void InitDataAndSetComponentState()
        {
            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            goldText.text   = gloalData.GoldCup.ToString();
            silverText.text = gloalData.SilverCup.ToString();
            bronzeText.text = gloalData.BronzeCup.ToString();
        }
Beispiel #6
0
        protected void CreatItem()
        {
            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;
            int             count          = gloalData.ItemCount;

            for (int i = 0; i < count; i++)
            {
                GameObject    tempObj       = UnityEngine.GameObject.Instantiate(GetStorePanel.templateItem);
                ItemComponent itemComponent = tempObj.AddComponent <ItemComponent>();
                GetStorePanel.itemComponents.Add(itemComponent);
                tempObj.name = "Item_" + i;
                tempObj.transform.SetParent(GetStorePanel.target, false);
                tempObj.SetActive(true);
            }
        }
        public override void Execute(INotification notification)
        {
            base.Execute(notification);
            this.Log("游戏启动成功");

            GameObject canvas  = GameObject.Find("Canvas");
            GameObject tempObj = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("Prefab/HomePanel"));

            tempObj.name = "HomePanel";
            tempObj.transform.SetParent(canvas.transform, false);
            tempObj.AddComponent <HomePanel>();
            //获取数据
            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            //初始化声音
            ManagerFacade.Instance.SetMusicVolume((float)gloalData.MusicVolume);
            ManagerFacade.Instance.SetMusicVolume((float)gloalData.SoundVolume);
            ManagerFacade.Instance.PlayMusic("Background Music", SoundManager.SoundType.BackGround);
        }
        void Start()
        {
            itemBG     = transform.Find("itemBG").GetComponent <Image>();
            priceIcon  = transform.Find("priceIcon").GetComponent <Image>();
            itemIcon   = transform.Find("itemBG/Icon").GetComponent <Image>();
            buyButton  = transform.Find("BuyButton").GetComponent <Button>();
            numberText = transform.Find("priceIcon/numberText").GetComponent <Text>();

            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            tempGlobalData = gloalData;
            currencyType   = (CurrencyType)UnityEngine.Random.Range(1, 4);

            priceIcon.sprite = ManagerFacade.Instance.LoadSprite(currencyType + "Cup");

            number          = UnityEngine.Random.Range(20, 50);
            numberText.text = number.ToString();
            buyButton.onClick.AddListener(BuyButtonOnClick);

            ChangeTheme();
        }
        public override void Execute(INotification notification)
        {
            base.Execute(notification);
            SettingPanel settingPanelView = notification.Body as SettingPanel;

            if (settingPanelView == null)
            {
                this.LogError("settingPanelView为null,请检查");
                return;
            }

            GlobalDataProxy gloalDataProxy = ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME) as GlobalDataProxy;
            GlobalData      gloalData      = gloalDataProxy.GetGlobalData;

            gloalData.BoyOrGirl   = settingPanelView.tempBoyOrGirl;
            gloalData.MusicVolume = settingPanelView.tempMusicVolume;
            gloalData.SoundVolume = settingPanelView.tempSoundVolume;
            gloalDataProxy.SerializeData();

            //设置声音相关
            ManagerFacade.Instance.SetMusicVolume((float)gloalData.MusicVolume);
            ManagerFacade.Instance.SetSoundVolume((float)gloalData.SoundVolume);
        }
Beispiel #10
0
        protected override void InitDataAndSetComponentState()
        {
            GlobalDataProxy globalDataProxy = (GlobalDataProxy)ApplicationFacade.Instance.RetrieveProxy(GlobalDataProxy.NAME);
            GlobalData      GlobalData      = globalDataProxy.GetGlobalData;
            int             tempBoyOrGirl   = GlobalData.BoyOrGirl;

            if (tempBoyOrGirl == 0)
            {
                grilToggle.isOn = true;
            }
            else
            {
                boyToggle.isOn = true;
            }
            tempMusicVolume   = (float)GlobalData.MusicVolume;
            musicSlider.value = tempMusicVolume;
            if (tempMusicVolume <= 0)
            {
                OpenMusicMuteBg();
            }
            else
            {
                CloseMusicMuteBg();
            }

            tempSoundVolume   = (float)GlobalData.SoundVolume;
            soundSlider.value = tempSoundVolume;
            if (tempSoundVolume <= 0)
            {
                OpenSoundMuteBg();
            }
            else
            {
                CloseSoundMuteBg();
            }
        }