示例#1
0
 public void SetAvatarHPData(EndlessAvatarHp avatarHPData, Action <bool> avatarDie = null)
 {
     this._avatarHPData     = avatarHPData;
     this.avatarDieCallBack = avatarDie;
     this._update           = true;
     this.CheckAndSetupView();
 }
示例#2
0
        public void SetupView(AvatarDataItem avatarDataItem, bool isSelected, EndlessAvatarHp avatarHP = null)
        {
            this._avatarData = avatarDataItem;
            this._avatarHp   = avatarHP;
            base.transform.Find("Panel").gameObject.SetActive(false);
            base.transform.Find("BG").GetComponent <Image>().sprite    = this.GetBGSprite();
            base.transform.Find("Frame").GetComponent <Image>().sprite = this.GetBorderSprite();
            base.transform.Find("Icon").GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(this._avatarData.IconPath);
            base.transform.Find("PopUp").gameObject.SetActive(this._avatarData.CanStarUp);
            base.transform.Find("LockImg").gameObject.SetActive(!this._avatarData.UnLocked);
            List <int> memberList = Singleton <PlayerModule> .Instance.playerData.GetMemberList(1);

            bool flag  = (memberList.Count > 0) && memberList.Contains(this._avatarData.avatarID);
            bool flag2 = (memberList.Count > 0) && (this._avatarData.avatarID == memberList[0]);

            base.transform.Find("FlagImg").gameObject.SetActive(flag);
            base.transform.Find("FlagImg").GetComponent <Image>().color = !flag2?MiscData.GetColor("TotalWhite") : MiscData.GetColor("Yellow");

            base.transform.Find("AvatarStar").gameObject.SetActive(this._avatarData.UnLocked);
            if (this._avatarData.UnLocked)
            {
                this.SetAvatarStar();
            }
            base.transform.Find("LvText").GetComponent <Text>().text = !this._avatarData.UnLocked ? LocalizationGeneralLogic.GetText("Menu_AvatarLocked", new object[0]) : ("Lv." + this._avatarData.level);
            base.transform.Find("HPRemain").gameObject.SetActive(avatarHP != null);
            base.transform.Find("Icon").GetComponent <Image>().color = MiscData.GetColor("TotalWhite");
            base.transform.Find("FlashHint").gameObject.SetActive(false);
            base.transform.Find("LvText").gameObject.SetActive(true);
            this.SetUpAvatarDispatched(Singleton <IslandModule> .Instance.IsAvatarDispatched(this._avatarData.avatarID));
            if (avatarHP != null)
            {
                base.transform.Find("HPRemain").GetComponent <MonoRemainHP>().SetAvatarHPData(this._avatarHp, new Action <bool>(this.EndlessAvatarDieCallBack));
            }
            this.SetupSelectedView(isSelected);
        }
示例#3
0
        public DateTime CheckAvatarHPChanged(EndlessAvatarHp avatarHPData)
        {
            if ((avatarHPData.get_hp_percent() >= 100) || !avatarHPData.get_next_recover_timeSpecified())
            {
                return(DateTime.MinValue);
            }
            DateTime dateTimeFromTimeStamp = Miscs.GetDateTimeFromTimeStamp(avatarHPData.get_next_recover_time());

            if (TimeUtil.Now >= dateTimeFromTimeStamp)
            {
                Singleton <NetworkManager> .Instance.RequestEndlessAvatarHp();
            }
            return(dateTimeFromTimeStamp);
        }
示例#4
0
        public uint CreateAvatar(AvatarDataItem avatarDataItem, bool isLocal, Vector3 initPos, Vector3 initDir, uint runtimeID, bool isLeader, bool leaderSkillOn, bool isHelper = false, bool useLow = false)
        {
            BaseMonoAvatar component         = null;
            string         avatarRegistryKey = avatarDataItem.AvatarRegistryKey;
            GameObject     obj2  = null;
            int            index = -1;

            for (int i = 0; i < this._preloadedAvatar.Count; i++)
            {
                if (this._preloadedAvatar[i].Item1 == avatarRegistryKey)
                {
                    obj2  = this._preloadedAvatar[i].Item2;
                    index = i;
                    break;
                }
            }
            if (obj2 != null)
            {
                obj2.GetComponent <BaseMonoAvatar>().Enable();
                this._preloadedAvatar.RemoveAt(index);
            }
            else
            {
                useLow = useLow || (!GlobalVars.AVATAR_USE_DYNAMIC_BONE || (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Multi));
                obj2   = (GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(AvatarData.GetPrefabResPath(avatarRegistryKey, useLow), BundleType.RESOURCE_FILE), InLevelData.CREATE_INIT_POS, Quaternion.Euler(0f, 200f, 0f));
            }
            component = obj2.GetComponent <BaseMonoAvatar>();
            if (runtimeID == 0)
            {
                runtimeID = Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(3);
            }
            component.Init(isLocal, runtimeID, avatarDataItem.AvatarRegistryKey, avatarDataItem.GetWeapon().ID, initPos, initDir, isLeader);
            bool isPlayerAvatar = !isHelper;

            this.RegisterAvatar(component, isLocal, isPlayerAvatar, isHelper);
            AvatarActor actor = Singleton <EventManager> .Instance.CreateActor <AvatarActor>(component);

            actor.InitAvatarDataItem(avatarDataItem, isLocal, isHelper, isLeader, leaderSkillOn);
            actor.InitGalTouchBuff(avatarDataItem);
            actor.PostInit();
            if (Singleton <LevelScoreManager> .Instance.LevelType == 4)
            {
                EndlessAvatarHp endlessAvatarHPData = Singleton <EndlessModule> .Instance.GetEndlessAvatarHPData(avatarDataItem.avatarID);

                actor.HP = (actor.maxHP * endlessAvatarHPData.get_hp_percent()) / 100f;
                actor.SP = (actor.maxSP * endlessAvatarHPData.get_sp_percent()) / 100f;
            }
            ConfigAvatar config = component.config;

            for (int j = 0; j < config.CommonArguments.PreloadEffectPatternGroups.Length; j++)
            {
                Singleton <EffectManager> .Instance.PreloadEffectGroup(config.CommonArguments.PreloadEffectPatternGroups[j], false);
            }
            if (component is MonoBronya)
            {
                if (actor.HasAppliedAbilityName("Weapon_Additional_BronyaLaser"))
                {
                    Singleton <EffectManager> .Instance.PreloadEffectGroup("Bronya_Laser_Effects", false);
                }
                else
                {
                    Singleton <EffectManager> .Instance.PreloadEffectGroup("Bronya_Gun_Effects", false);
                }
            }
            for (int k = 0; k < config.CommonArguments.RequestSoundBankNames.Length; k++)
            {
                Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(config.CommonArguments.RequestSoundBankNames[k]);
            }
            return(component.GetRuntimeID());
        }