Ejemplo n.º 1
0
    private void Execute()
    {
        HUDWheel.HUDWheelSlot selectedSlot = this.m_SelectedSlot;
        switch (selectedSlot + 1)
        {
        case HUDWheel.HUDWheelSlot.Craft:
            this.OnMap();
            break;

        case HUDWheel.HUDWheelSlot.Sleep:
            this.OnCraft();
            break;

        case HUDWheel.HUDWheelSlot.Notebook:
            this.OnSleep();
            break;

        case HUDWheel.HUDWheelSlot.Backpack:
            this.OnNotebook();
            break;

        case HUDWheel.HUDWheelSlot.Inspect:
            this.OnBackpack();
            break;

        case HUDWheel.HUDWheelSlot.Count:
            this.OnInspect();
            break;
        }
    }
Ejemplo n.º 2
0
    protected override void Awake()
    {
        base.Awake();
        HUDWheel.s_Instance = this;
        for (int i = 0; i < 6; i++)
        {
            RawImage[]            selections   = this.m_Selections;
            int                   num          = i;
            Transform             transform    = base.transform;
            HUDWheel.HUDWheelSlot hudwheelSlot = (HUDWheel.HUDWheelSlot)i;
            selections[num] = transform.Find(hudwheelSlot.ToString() + "Sel").GetComponent <RawImage>();
            RawImage[]            icons         = this.m_Icons;
            int                   num2          = i;
            Transform             transform2    = base.transform;
            HUDWheel.HUDWheelSlot hudwheelSlot2 = (HUDWheel.HUDWheelSlot)i;
            icons[num2] = transform2.Find(hudwheelSlot2.ToString() + "Icon").GetComponent <RawImage>();
            RawImage[]            iconsHL       = this.m_IconsHL;
            int                   num3          = i;
            Transform             transform3    = base.transform;
            HUDWheel.HUDWheelSlot hudwheelSlot3 = (HUDWheel.HUDWheelSlot)i;
            iconsHL[num3] = transform3.Find(hudwheelSlot3.ToString() + "IconHL").GetComponent <RawImage>();
        }
        this.m_CenterText  = GreenHellGame.Instance.GetLocalization().Get("HUD_Wheel_Center");
        this.m_AudioSource = base.gameObject.AddComponent <AudioSource>();
        this.m_AudioSource.outputAudioMixerGroup = GreenHellGame.Instance.GetAudioMixerGroup(AudioMixerGroupGame.Player);
        AudioClip audioClip = Resources.Load <AudioClip>("Sounds/wheel_menu");

        if (!audioClip)
        {
            audioClip = Resources.Load <AudioClip>("Sounds/TempSounds/wheel_menu");
        }
        this.m_AudioSource.clip = audioClip;
    }
Ejemplo n.º 3
0
    private void UpdateSelection()
    {
        HUDWheel.HUDWheelSlot selectedSlot = this.m_SelectedSlot;
        float   num  = (float)Screen.width;
        Vector3 from = Input.mousePosition - base.transform.position;
        float   num2 = from.magnitude / (num * 0.5f);

        if (num2 < 0.08f)
        {
            this.m_SelectedSlot = HUDWheel.HUDWheelSlot.None;
            for (int i = 0; i < 6; i++)
            {
                this.m_Selections[i].enabled = false;
                this.m_Icons[i].enabled      = true;
                this.m_IconsHL[i].enabled    = false;
            }
            this.UpdateText();
            return;
        }
        from.Normalize();
        float num3 = Vector3.Angle(from, Vector3.up);

        if (Input.mousePosition.x < base.transform.position.x)
        {
            num3 = 360f - num3;
        }
        this.m_SelectedSlot = (HUDWheel.HUDWheelSlot)(num3 / 360f * 6f);
        for (int j = 0; j < 6; j++)
        {
            this.m_Selections[j].enabled = (j == (int)this.m_SelectedSlot && this.IsSlotActive((HUDWheel.HUDWheelSlot)j));
            this.m_Icons[j].enabled      = (j != (int)this.m_SelectedSlot || !this.IsSlotActive((HUDWheel.HUDWheelSlot)j));
            this.m_IconsHL[j].enabled    = (j == (int)this.m_SelectedSlot && this.IsSlotActive((HUDWheel.HUDWheelSlot)j));
        }
        if (this.m_SelectedSlot == HUDWheel.HUDWheelSlot.Inspect && !Player.Get().CanStartBodyInspection())
        {
            this.m_SelectedSlot          = HUDWheel.HUDWheelSlot.None;
            this.m_Selections[5].enabled = false;
        }
        this.UpdateText();
        if (this.m_SelectedSlot != HUDWheel.HUDWheelSlot.None && selectedSlot != this.m_SelectedSlot && this.m_Selections[(int)this.m_SelectedSlot].enabled)
        {
            if (this.m_AudioSource.isPlaying)
            {
                this.m_AudioSource.Stop();
            }
            this.m_AudioSource.Play();
        }
    }
Ejemplo n.º 4
0
 private bool IsSlotActive(HUDWheel.HUDWheelSlot slot)
 {
     return((slot != HUDWheel.HUDWheelSlot.Craft || Player.Get().CanStartCrafting()) && (slot != HUDWheel.HUDWheelSlot.Notebook || Player.Get().CanShowNotepad()) && (slot != HUDWheel.HUDWheelSlot.Map || Player.Get().CanShowMap()) && (slot != HUDWheel.HUDWheelSlot.Sleep || Player.Get().CanSleep()) && (slot != HUDWheel.HUDWheelSlot.Inspect || Player.Get().CanStartBodyInspection()));
 }
Ejemplo n.º 5
0
 private void UpdateSelection()
 {
     HUDWheel.HUDWheelSlot selectedSlot = this.m_SelectedSlot;
     if (GreenHellGame.IsPCControllerActive())
     {
         float   num  = (float)Screen.width;
         Vector3 from = Input.mousePosition - base.transform.position;
         if (from.magnitude / (num * 0.5f) < 0.08f)
         {
             this.m_SelectedSlot = HUDWheel.HUDWheelSlot.None;
             for (int i = 0; i < 6; i++)
             {
                 this.m_Selections[i].enabled = false;
                 this.m_Icons[i].enabled      = true;
                 this.m_IconsHL[i].enabled    = false;
             }
             this.UpdateText();
             return;
         }
         from.Normalize();
         float num2 = Vector3.Angle(from, Vector3.up);
         if (Input.mousePosition.x < base.transform.position.x)
         {
             num2 = 360f - num2;
         }
         this.m_SelectedSlot = (HUDWheel.HUDWheelSlot)(num2 / 360f * 6f);
     }
     else
     {
         float   axis  = InputsManager.Get().GetAxis("RightStickX");
         float   axis2 = InputsManager.Get().GetAxis("RightStickY");
         Vector2 zero  = Vector2.zero;
         zero.x = axis;
         zero.y = axis2;
         if (zero.magnitude <= 0.1f)
         {
             this.m_DeadZoneDuration += Time.deltaTime;
             if (this.m_DeadZoneDuration >= 0.15f)
             {
                 this.m_SelectedSlot = HUDWheel.HUDWheelSlot.None;
                 for (int j = 0; j < 6; j++)
                 {
                     this.m_Selections[j].enabled = false;
                     this.m_Icons[j].enabled      = true;
                     this.m_IconsHL[j].enabled    = false;
                 }
             }
             this.UpdateText();
             return;
         }
         this.m_DeadZoneDuration = 0f;
         float num3 = Vector3.Angle(zero, Vector3.up);
         if (axis > 0f)
         {
             num3 = 360f - num3;
         }
         this.m_SelectedSlot = (HUDWheel.HUDWheelSlot)(num3 / 360f * 6f);
     }
     for (int k = 0; k < 6; k++)
     {
         this.m_Selections[k].enabled = (k == (int)this.m_SelectedSlot && this.IsSlotActive((HUDWheel.HUDWheelSlot)k));
         this.m_Icons[k].enabled      = (k != (int)this.m_SelectedSlot || !this.IsSlotActive((HUDWheel.HUDWheelSlot)k));
         this.m_IconsHL[k].enabled    = (k == (int)this.m_SelectedSlot && this.IsSlotActive((HUDWheel.HUDWheelSlot)k));
     }
     if (HUDWheel.HUDWheelSlot.Inspect == this.m_SelectedSlot && !Player.Get().CanStartBodyInspection())
     {
         this.m_SelectedSlot          = HUDWheel.HUDWheelSlot.None;
         this.m_Selections[5].enabled = false;
     }
     if (HUDWheel.HUDWheelSlot.Sleep == this.m_SelectedSlot && !Player.Get().CanSleep())
     {
         this.m_SelectedSlot          = HUDWheel.HUDWheelSlot.None;
         this.m_Selections[2].enabled = false;
     }
     this.UpdateText();
     if (this.m_SelectedSlot != HUDWheel.HUDWheelSlot.None && selectedSlot != this.m_SelectedSlot && this.m_Selections[(int)this.m_SelectedSlot].enabled)
     {
         if (this.m_AudioSource.isPlaying)
         {
             this.m_AudioSource.Stop();
         }
         this.m_AudioSource.Play();
     }
 }
Ejemplo n.º 6
0
 private bool IsSlotActive(HUDWheel.HUDWheelSlot slot)
 {
     return((slot != HUDWheel.HUDWheelSlot.Craft || Player.Get().CanStartCrafting()) && (slot != HUDWheel.HUDWheelSlot.Notebook || Player.Get().CanShowNotepad()) && (slot != HUDWheel.HUDWheelSlot.Map || Player.Get().CanShowMap()) && (slot != HUDWheel.HUDWheelSlot.Sleep || Player.Get().CanSleep()) && (slot != HUDWheel.HUDWheelSlot.Inspect || Player.Get().CanStartBodyInspection()) && (slot != HUDWheel.HUDWheelSlot.Backpack || !Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash)));
 }