// Token: 0x06001FAD RID: 8109 RVA: 0x00097F80 File Offset: 0x00096180
    public static Vector3 ApplyDispersion(Vector3 shootingRay, UberStrikeItemWeaponView view, bool ironSight)
    {
        float num = WeaponConfigurationHelper.GetAccuracySpread(view);

        if (WeaponFeedbackManager.Instance && WeaponFeedbackManager.Instance.IsIronSighted && ironSight)
        {
            num *= 0.5f;
        }
        Vector2 vector = UnityEngine.Random.insideUnitCircle * num * 0.5f;

        return(Quaternion.AngleAxis(vector.x, GameState.Current.Player.WeaponCamera.transform.right) * Quaternion.AngleAxis(vector.y, GameState.Current.Player.WeaponCamera.transform.up) * shootingRay);
    }
Exemplo n.º 2
0
    // Token: 0x060009B5 RID: 2485 RVA: 0x0003D888 File Offset: 0x0003BA88
    public void SetItem(IUnityItem item, Rect bounds, PopupViewSide side, int daysLeft = -1, BuyingDurationType duration = BuyingDurationType.None)
    {
        if (Event.current.type != EventType.Repaint || item == null || Singleton <ItemManager> .Instance.IsDefaultGearItem(item.View.PrefabName) || (item.View.LevelLock > PlayerDataManager.PlayerLevel && !Singleton <InventoryManager> .Instance.Contains(item.View.ID)))
        {
            return;
        }
        bool flag = this._alpha < Time.time + 0.1f;

        this._alpha = Mathf.Lerp(this._alpha, Time.time + 1.1f, Time.deltaTime * 12f);
        if (this._item != item || this._cacheRect != bounds || !this.IsEnabled)
        {
            this._cacheRect   = bounds;
            bounds            = GUITools.ToGlobal(bounds);
            this.IsEnabled    = true;
            this._item        = item;
            this._level       = ((item.View == null) ? 0 : item.View.LevelLock);
            this._description = ((item.View == null) ? string.Empty : item.View.Description);
            this._daysLeft    = daysLeft;
            this._criticalHit = 0;
            this._duration    = duration;
            switch (side)
            {
            case PopupViewSide.Left:
            {
                float tipPosition = bounds.y - 10f + bounds.height * 0.5f;
                Rect  rect        = new Rect(bounds.x - this.Size.x - 9f, bounds.y - this.Size.y * 0.5f, this.Size.x, this.Size.y);
                Rect  rect2       = new Rect(rect.xMax - 1f, tipPosition, 12f, 21f);
                if (rect.y <= (float)GlobalUIRibbon.Instance.Height())
                {
                    rect.y += (float)GlobalUIRibbon.Instance.Height() - rect.y;
                }
                if (rect.yMax >= (float)Screen.height)
                {
                    rect.y -= rect.yMax - (float)Screen.height;
                }
                if (rect2.y < this._finalRect.y || rect2.yMax > this._finalRect.yMax || this._finalRect.x != rect.x)
                {
                    this._finalRect = rect;
                    if (flag)
                    {
                        this._rect = rect;
                    }
                }
                this.OnDrawTip = delegate()
                {
                    GUI.DrawTexture(new Rect(this._rect.xMax - 1f, tipPosition, 12f, 21f), ConsumableHudTextures.TooltipRight);
                };
                break;
            }

            case PopupViewSide.Top:
            {
                float tipPosition = bounds.x - 10f + bounds.width * 0.5f;
                Rect  rect3       = new Rect(bounds.x + (bounds.width - this.Size.x) * 0.5f, bounds.y - this.Size.y - 9f, this.Size.x, this.Size.y);
                Rect  rect4       = new Rect(tipPosition, rect3.yMax - 1f, 21f, 12f);
                if (rect3.xMin <= 10f)
                {
                    rect3.x = 10f;
                }
                if (rect3.xMax >= (float)(Screen.width - 10))
                {
                    rect3.x -= rect3.xMax - (float)Screen.width + 10f;
                }
                if (rect4.x < this._finalRect.x || rect4.xMax > this._finalRect.xMax || this._finalRect.y != rect3.y)
                {
                    this._finalRect = rect3;
                    if (flag)
                    {
                        this._rect = rect3;
                    }
                }
                this.OnDrawTip = delegate()
                {
                    GUI.DrawTexture(new Rect(tipPosition, this._rect.yMax - 1f, 21f, 12f), ConsumableHudTextures.TooltipDown);
                };
                break;
            }
            }
            switch (item.View.ItemClass)
            {
            case UberstrikeItemClass.WeaponMelee:
            {
                this.OnDrawItemDetails = new Action(this.DrawMeleeWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView != null)
                {
                    this._damage.Value   = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView);
                    this._damage.Max     = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView);
                    this._fireRate.Max   = WeaponConfigurationHelper.MaxRateOfFire;
                }
                return;
            }

            case UberstrikeItemClass.WeaponMachinegun:
            case UberstrikeItemClass.WeaponShotgun:
            case UberstrikeItemClass.WeaponSniperRifle:
            {
                this.OnDrawItemDetails = new Action(this.DrawInstantHitWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView2 = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView2 != null)
                {
                    this._ammo.Value     = WeaponConfigurationHelper.GetAmmo(uberStrikeItemWeaponView2);
                    this._ammo.Max       = WeaponConfigurationHelper.MaxAmmo;
                    this._damage.Value   = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView2);
                    this._damage.Max     = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView2);
                    this._fireRate.Max   = WeaponConfigurationHelper.MaxRateOfFire;
                    this._accuracy.Value = WeaponConfigurationHelper.MaxAccuracySpread - WeaponConfigurationHelper.GetAccuracySpread(uberStrikeItemWeaponView2);
                    this._accuracy.Max   = WeaponConfigurationHelper.MaxAccuracySpread;
                    //_armorPierced.Value = WeaponConfigurationHelper.GetArmorPierced(uberStrikeItemWeaponView2);
                    //_armorPierced.Max = WeaponConfigurationHelper.MaxArmorPierced;

                    if (item.View.ItemProperties.ContainsKey(ItemPropertyType.CritDamageBonus))
                    {
                        this._criticalHit = item.View.ItemProperties[ItemPropertyType.CritDamageBonus];
                    }
                    else
                    {
                        this._criticalHit = 0;
                    }
                }
                return;
            }

            case UberstrikeItemClass.WeaponCannon:
            case UberstrikeItemClass.WeaponSplattergun:
            case UberstrikeItemClass.WeaponLauncher:
            {
                this.OnDrawItemDetails = new Action(this.DrawProjectileWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView3 = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView3 != null)
                {
                    this._ammo.Value         = WeaponConfigurationHelper.GetAmmo(uberStrikeItemWeaponView3);
                    this._ammo.Max           = WeaponConfigurationHelper.MaxAmmo;
                    this._damage.Value       = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView3);
                    this._damage.Max         = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value     = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView3);
                    this._fireRate.Max       = WeaponConfigurationHelper.MaxRateOfFire;
                    this._velocity.Value     = WeaponConfigurationHelper.GetProjectileSpeed(uberStrikeItemWeaponView3);
                    this._velocity.Max       = WeaponConfigurationHelper.MaxProjectileSpeed;
                    this._damageRadius.Value = WeaponConfigurationHelper.GetSplashRadius(uberStrikeItemWeaponView3);
                    this._damageRadius.Max   = WeaponConfigurationHelper.MaxSplashRadius;
                }
                return;
            }

            case UberstrikeItemClass.GearBoots:
            case UberstrikeItemClass.GearHead:
            case UberstrikeItemClass.GearFace:
            case UberstrikeItemClass.GearUpperBody:
            case UberstrikeItemClass.GearLowerBody:
            case UberstrikeItemClass.GearGloves:
            case UberstrikeItemClass.GearHolo:
                this.OnDrawItemDetails   = new Action(this.DrawGear);
                this._armorCarried.Value = (float)((UberStrikeItemGearView)item.View).ArmorPoints;
                this._armorCarried.Max   = 200f;
                return;

            case UberstrikeItemClass.QuickUseGeneral:
            case UberstrikeItemClass.QuickUseGrenade:
            case UberstrikeItemClass.QuickUseMine:
                this.OnDrawItemDetails = new Action(this.DrawQuickItem);
                return;
            }
            this.OnDrawItemDetails = null;
        }
    }