示例#1
0
        void UpdateWeaponUiGameObjects(EEquipType _eType)
        {
            Sprite _equippedIcon   = uiTargetHandler.MyEquippedWeaponIcon;
            Sprite _unequippedIcon = uiTargetHandler.MyUnequippedWeaponIcon;

            if (_eType == EEquipType.Primary)
            {
                PrimaryWeaponGameObject.transform.SetSiblingIndex(1);
                SecondaryWeaponGameObject.transform.SetSiblingIndex(0);
                PrimaryWeaponGameObject.transform.localScale   = EquippedScale;
                SecondaryWeaponGameObject.transform.localScale = UnequippedScale;

                if (_equippedIcon && _unequippedIcon)
                {
                    PrimaryWeaponUIImage.sprite   = _equippedIcon;
                    PrimaryWeaponUIImage.color    = EquippedColor;
                    SecondaryWeaponUIImage.sprite = _unequippedIcon;
                    SecondaryWeaponUIImage.color  = UnequippedColor;
                }
            }
            else
            {
                PrimaryWeaponGameObject.transform.SetSiblingIndex(0);
                SecondaryWeaponGameObject.transform.SetSiblingIndex(1);
                PrimaryWeaponGameObject.transform.localScale   = UnequippedScale;
                SecondaryWeaponGameObject.transform.localScale = EquippedScale;
                if (_equippedIcon && _unequippedIcon)
                {
                    SecondaryWeaponUIImage.sprite = _equippedIcon;
                    SecondaryWeaponUIImage.color  = EquippedColor;
                    PrimaryWeaponUIImage.sprite   = _unequippedIcon;
                    PrimaryWeaponUIImage.color    = UnequippedColor;
                }
            }
        }
        public virtual void CallOnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
        {
            //If MyEquippedWeaponType Hasn't Been Set, Do Not Update MyUnequippedWeaponType
            if (MyEquippedWeaponType != EWeaponType.NoWeaponType)
            {
                MyUnequippedWeaponType = MyEquippedWeaponType;
            }
            MyEquippedWeaponType = _weaponType;
            if (globalStatHandler &&
                globalStatHandler.WeaponStatDictionary.ContainsKey(MyEquippedWeaponType) &&
                globalStatHandler.WeaponStatDictionary.ContainsKey(MyUnequippedWeaponType))
            {
                MyEquippedWeaponIcon =
                    globalStatHandler.WeaponStatDictionary
                    [MyEquippedWeaponType].WeaponIcon;
                if (MyUnequippedWeaponType != EWeaponType.NoWeaponType)
                {
                    MyUnequippedWeaponIcon =
                        globalStatHandler.WeaponStatDictionary
                        [MyUnequippedWeaponType].WeaponIcon;
                }
            }

            if (OnWeaponChanged != null)
            {
                OnWeaponChanged(_eType, _weaponType, _wUsage, _equipped);
            }
        }
示例#3
0
文件: CRole.cs 项目: cash2one/oold
        private uint _getEquipIndex(EEquipType a_equipType)
        {
            uint id    = (uint)a_equipType;
            uint index = id - 1;

            return(index);
        }
 void OnWeaponTypeChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (_equipped)
     {
         SetEquippedItem(GetTPSItemFromWeaponType(_weaponType));
     }
 }
示例#5
0
 void OnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (_equipped)
     {
         UpdateWeaponUiGameObjects(_eType);
     }
 }
示例#6
0
 public bool SerializeFrom(UnityUtility.CStream msgStream)
 {
     m_equipID       = msgStream.ReadUInt();
     m_equipType     = (EEquipType)msgStream.ReadUInt();
     m_equipTPID     = msgStream.ReadUInt();
     m_equipLevel    = msgStream.ReadUInt();
     m_equipAddLevel = msgStream.ReadUInt();
     m_equipQuality  = (EQualityID)msgStream.ReadUInt();
     m_leftSeconds   = msgStream.ReadULong();
     m_equipStatus   = (EEquipStatus)msgStream.ReadUInt();
     m_battleAttr.SerializeFrom(msgStream);
     m_attachAttr.SerializeFrom(msgStream);
     //m_attachBattleAttr.SerializeFrom(msgStream);
     m_attachAttr.getTotalAttach(ref m_attachBattleAttr);
     m_addBattleAttr.SerializeFrom(msgStream);
     m_gemSlotCount = msgStream.ReadUInt();
     m_gemsCount    = msgStream.ReadUInt();
     for (int j = 0; j < m_gemsCount; ++j)
     {
         CGem equipGem = new CGem();
         equipGem.SerializeFrom(msgStream);
         m_gemsList.Add(equipGem);
     }
     m_combat = msgStream.ReadUInt();
     return(true);
 }
 public virtual void CallOnEquipTypeChanged(EEquipType _eType)
 {
     MyEquippedType = _eType;
     if (OnEquipTypeChanged != null)
     {
         OnEquipTypeChanged(_eType);
     }
 }
示例#8
0
        void HandleEquipTypeChanged(EEquipType _eType)
        {
            myCharacterStats.EquippedWeapon = _eType;
            var _weapon = myCharacterStats.EquippedWeapon == EEquipType.Primary ?
                          myCharacterStats.PrimaryWeapon : myCharacterStats.SecondaryWeapon;
            var _wUsage = GetWeaponStatsFromWeaponType(_weapon).WeaponUsage;

            eventHandler.CallOnWeaponChanged(myCharacterStats.EquippedWeapon, _weapon, _wUsage, true);
        }
示例#9
0
文件: CRole.cs 项目: cash2one/oold
        public UInt32 getEquipID(EEquipType a_equipType)
        {
            uint index = _getEquipIndex(a_equipType);

            if (!_isEquipIndex(index))
            {
                return(0);
            }
            return(m_equipID[index]);
        }
示例#10
0
文件: CRole.cs 项目: cash2one/oold
        public bool setEquipID(EEquipType a_equipType, UInt32 a_equipID)
        {
            uint index = _getEquipIndex(a_equipType);

            if (!_isEquipIndex(index))
            {
                return(false);
            }
            m_equipID[index] = a_equipID;
            return(true);
        }
 protected virtual void OnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (IsInvoking("UpdateBattleBehavior"))
     {
         bool       _commandAttackRestart = myEventHandler.bIsCommandAttacking ? true : false;
         AllyMember _currentTargetRestart = currentTargettedEnemy;
         myEventHandler.CallEventFinishedMoving();
         myEventHandler.CallEventStopTargettingEnemy();
         StartCoroutine(OnWeaponChangedDelay(_commandAttackRestart, _currentTargetRestart));
     }
 }
        /// <summary>
        /// No Event Yet, But considering using this as a handler when
        /// picking up ammo. Used to Update Unequipped Ammo When Weapon Switch
        /// Hasn't Yet Occurred.
        /// </summary>
        void OnUnequippedAmmoChanged()
        {
            int        _loaded          = 0;
            int        _unloaded        = 0;
            EEquipType _unequippedEType = myEventHandler.MyEquippedType == EEquipType.Primary ?
                                          EEquipType.Secondary : EEquipType.Primary;

            GetAmmoCountForEquipType(out _loaded, out _unloaded);
            myEventHandler.UpdateWeaponAmmoCount(EEquipType.Secondary,
                                                 _loaded, _unloaded);
        }
 /// <summary>
 /// Used Primarily to update unequipped ammo count, called
 /// from allyStatsController.
 /// </summary>
 /// <param name="_eType"></param>
 /// <param name="_loaded"></param>
 /// <param name="_unloaded"></param>
 public void UpdateWeaponAmmoCount(EEquipType _eType, int _loaded, int _unloaded)
 {
     if (_eType == EEquipType.Primary)
     {
         PrimaryLoadedAmmoAmount   = _loaded;
         PrimaryUnloadedAmmoAmount = _unloaded;
     }
     else
     {
         SecondaryLoadedAmmoAmount   = _loaded;
         SecondaryUnloadedAmmoAmount = _unloaded;
     }
     CallOnAmmoChanged(_loaded, _unloaded);
 }
示例#14
0
        void HandleWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
        {
            switch (_eType)
            {
            case EEquipType.Primary:
                if (_weaponType != myCharacterStats.PrimaryWeapon)
                {
                    myCharacterStats.PrimaryWeapon = _weaponType;
                }
                break;

            case EEquipType.Secondary:
                if (_weaponType != myCharacterStats.SecondaryWeapon)
                {
                    myCharacterStats.SecondaryWeapon = _weaponType;
                }
                break;

            default:
                break;
            }
        }
示例#15
0
 public UInt32 getEquipLevel(EEquipType a_equipType)
 {
     return(m_equipLevel[(int)a_equipType]);
 }
示例#16
0
 public UInt32 getEquipTPID(EEquipType a_equipType)
 {
     return(m_equipTPID[(int)a_equipType]);
 }