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合并后,交友时,需要把客人身上的灯光关掉
        }
Esempio n. 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);
                }
            };
        }
Esempio n. 3
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);
        }