public void RefreshRole(string petName)
        {
            base.PetName = !string.IsNullOrEmpty(petName) ? petName : LocalPetInfoAgent.getCurrentPet();
            string newPath = RoleConfig.GetGuestPath(base.PetName);

            this.LoadPrefab(newPath);
            this.RemoveLight();//小宠物的主人fbx和客人fbx合并后,交友时,需要把客人身上的灯光关掉
        }
Example #2
0
        private void OpenNimItemBox(UIState state)
        {
            this.uiNimBox.SetStatus(true);
            this.uiNimBox.NimImage.gameObject.SetActive(false);
            MissionInfo info = this.MissionConfig.GetMissionInfoByMissionId(missionId);

            if (info != null && this.treasureBoxIndex < info.listTreasureBox.Count)
            {
                TreasureBox treasureBox = this.TreasureBoxConfig.GetTreasureBoxById(info.listTreasureBox[this.treasureBoxIndex].BoxId);
                foreach (var treasure in treasureBox.items)
                {
                    GameObject resource = this.PrefabRoot.GetGameObject("Scenes", this.ItemConifg.GetImage(treasure.itemId));
                    if (resource && resource.GetComponent <SpriteRenderer>() != null)
                    {
                        uiNimBox.NimImage.sprite = resource.GetComponent <SpriteRenderer>().sprite;
                        Destroy(resource);
                    }
                }
            }

            this.uiNimBox.TreasureOpen.AnimationState.ClearTracks();
            this.uiNimBox.TreasureOpen.AnimationState.SetAnimation(0, "unboxing", false).Complete += delegate(Spine.TrackEntry track)
            {
                Debug.LogFormat("<><TreasureBoxOpen.OpenNimItemBox>Sound: {0}, HasModulePageOpened: {1}, InGuideView: {2}",
                                "nim_chest_open_" + LocalPetInfoAgent.getCurrentPet(), TopViewHelper.Instance.HasModulePageOpened(),
                                TopViewHelper.Instance.IsInGuideView());
                if (!TopViewHelper.Instance.HasModulePageOpened() || TopViewHelper.Instance.IsInGuideView())
                {//没有打开任何功能模块或正在引导才能播放此声音
                    Debug.LogFormat("<><TreasureBoxOpen.OpenNimItemBox>Sound: {0} ==== Playing", "nim_chest_open_" + LocalPetInfoAgent.getCurrentPet());
                    SoundPlayer.GetInstance().PlaySoundType("nim_chest_open_" + LocalPetInfoAgent.getCurrentPet());
                }
            };
            this.uiNimBox.TreasureOpen.AnimationState.AddAnimation(0, "Biological appearance", true, 0).Complete += delegate(Spine.TrackEntry track)
            {
                this.uiNimBox.NimImage.gameObject.SetActive(true);
                this.UIStateCompleteSignal.Dispatch(GetStateEnum());
                if (track.Loop)
                {
                    this.okButton.SetActive(true);
                }
            };
        }
        private void saveData(RegisterResponseData info)
        {
            if (!string.IsNullOrEmpty(info.x_child_sn))
            {
                //Debug.LogFormat("--------SaveSN--------RegisterCupService.saveData: {0}", info.x_child_sn);
                mLocalChildInfoAgent.saveChildSN(info.x_child_sn);
                FlurryUtil.LogEvent("Pair_Get_Childsn_Sunccess_Event");
            }
            else
            {
                FlurryUtil.LogEvent("Pair_Get_Childsn_Fail_Event");
                GuLog.Warning("pair data childsn is null");
            }

            //删除本地数据
            this.LocalPetInfoAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear currentPet");
            this.LocalUnlockedPetsAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear unlockedPets");

            //保存网络数据
            //mLocalCupAgent.saveCupToken(CupBuild.getCupSn(), info.token);
            mNativeDataManager.saveToken(info.token);
            mLocalCupAgent.saveCupID(CupBuild.getCupSn(), info.x_cup_sn);
            LocalPetInfoAgent.saveCurrentPet(info.pet_model);
            //重新保存语言数据
            this.PlayerDataManager.SaveLanguage(this.PlayerDataManager.Language);

            if (info.timestamp > 0)
            {
                mTimeManager.setServerTime(info.timestamp * (1000L));
            }

            if (!string.IsNullOrEmpty(info.timezone))
            {
                mTimeManager.setTimeZone(info.timezone);
            }
        }
Example #4
0
        private void OpenPropsItemBox(UIState state)
        {
            this.uiPropsBox.SetStatus(true);
            this.uiPropsBox.SetPosition(320.0f, 0.0f);
            this.uiPropsBox.SetPosition(0.0f, 0.5f);
            this.uiPropsBox.uiPropsItems.ForEach(t => t.SetStatus(false));
            MissionInfo missionInfo = this.MissionConfig.GetMissionInfoByMissionId(missionId);

            if (missionInfo != null && this.treasureBoxIndex < missionInfo.listTreasureBox.Count)
            {
                TreasureBox treasureBox = this.TreasureBoxConfig.GetTreasureBoxById(missionInfo.listTreasureBox[this.treasureBoxIndex].BoxId);
                for (int i = 0; i < treasureBox.items.Count; i++)
                {
                    GameObject resource = this.PrefabRoot.GetGameObject("Scenes", this.ItemConifg.GetImage(treasureBox.items[i].itemId));
                    if (resource && resource.GetComponent <SpriteRenderer>() != null)
                    {
                        this.uiPropsBox.uiPropsItems[i].SetStatus(true);
                        this.uiPropsBox.uiPropsItems[i].SetContent(resource.GetComponent <SpriteRenderer>().sprite, treasureBox.items[i].count);
                        this.FundDataManager.AddProperty(treasureBox.items[i].itemId, treasureBox.items[i].count);
                        Destroy(resource);
                    }
                }
            }

            Debug.LogFormat("<><TreasureBoxOpen.OpenPropsItemBox>Sound: {0}, HasModulePageOpened: {1}, InGuideView: {2}",
                            "nim_chest_open_" + LocalPetInfoAgent.getCurrentPet(), TopViewHelper.Instance.HasModulePageOpened(),
                            TopViewHelper.Instance.IsInGuideView());
            if (!TopViewHelper.Instance.HasModulePageOpened() || TopViewHelper.Instance.IsInGuideView())
            {//没有打开任何功能模块或正在引导才能播放此声音
                Debug.LogFormat("<><TreasureBoxOpen.OpenPropsItemBox>Sound: {0} ==== Playing", "nim_chest_open_" + LocalPetInfoAgent.getCurrentPet());
                SoundPlayer.GetInstance().PlaySoundType("nim_chest_open_" + LocalPetInfoAgent.getCurrentPet());
            }

            UIStateCompleteSignal.Dispatch(GetStateEnum());
            okButton.SetActive(true);
        }