Exemplo n.º 1
0
    private void InitCompassData()
    {
        WatchCompassData watchCompassData = new WatchCompassData();

        watchCompassData.m_Parent         = this.m_Canvas.transform.Find("Compass").gameObject;
        watchCompassData.m_Compass        = watchCompassData.m_Parent.transform.Find("CompassIcon").gameObject;
        watchCompassData.m_GPSCoordinates = watchCompassData.m_Parent.transform.Find("Coordinates").GetComponent <Text>();
        watchCompassData.m_Parent.SetActive(false);
        this.m_Datas.Add(3, watchCompassData);
    }
Exemplo n.º 2
0
    private void UpdateState()
    {
        switch (this.m_State)
        {
        case Watch.State.Time:
        {
            WatchTimeData watchTimeData = (WatchTimeData)this.m_Datas[0];
            DateTime      dateTime      = MainLevel.Instance.m_TODSky.Cycle.DateTime.AddDays((double)this.m_FakeDayOffset);
            int           hour          = dateTime.Hour;
            int           num           = hour % 10;
            int           num2          = (hour - num) / 10;
            int           minute        = dateTime.Minute;
            int           num3          = minute % 10;
            int           num4          = (minute - num3) / 10;
            watchTimeData.m_TimeHourDec.text    = num2.ToString();
            watchTimeData.m_TimeHourUnit.text   = num.ToString();
            watchTimeData.m_TimeMinuteDec.text  = num4.ToString();
            watchTimeData.m_TimeMinuteUnit.text = num3.ToString();
            Localization localization = GreenHellGame.Instance.GetLocalization();
            string       key          = "Watch_" + EnumUtils <DayOfWeek> .GetName(dateTime.DayOfWeek);

            watchTimeData.m_DayName.text = localization.Get(key, true);
            switch (dateTime.Month)
            {
            case 1:
                key = "Watch_January";
                break;

            case 2:
                key = "Watch_February";
                break;

            case 3:
                key = "Watch_March";
                break;

            case 4:
                key = "Watch_April";
                break;

            case 5:
                key = "Watch_May";
                break;

            case 6:
                key = "Watch_June";
                break;

            case 7:
                key = "Watch_July";
                break;

            case 8:
                key = "Watch_August";
                break;

            case 9:
                key = "Watch_September";
                break;

            case 10:
                key = "Watch_October";
                break;

            case 11:
                key = "Watch_November";
                break;

            case 12:
                key = "Watch_December";
                break;
            }
            watchTimeData.m_MonthName.text = localization.Get(key, true);
            int day  = dateTime.Day;
            int num5 = day % 10;
            int num6 = (day - num5) / 10;
            watchTimeData.m_DayDec.text  = num6.ToString();
            watchTimeData.m_DayUnit.text = num5.ToString();
            return;
        }

        case Watch.State.Sanity:
        {
            WatchSanityData watchSanityData = (WatchSanityData)this.m_Datas[1];
            watchSanityData.m_Sanity.BeatsPerMinute = (int)CJTools.Math.GetProportionalClamp(Watch.MIN_BEATS_PER_SEC, Watch.MAX_BEATS_PER_SEC, (float)PlayerSanityModule.Get().m_Sanity, 1f, 0f);
            watchSanityData.m_SanityText.text       = PlayerSanityModule.Get().m_Sanity.ToString();
            return;
        }

        case Watch.State.Macronutrients:
        {
            WatchMacronutrientsData watchMacronutrientsData = (WatchMacronutrientsData)this.m_Datas[2];
            float fillAmount = Player.Get().GetNutritionFat() / Player.Get().GetMaxNutritionFat();
            watchMacronutrientsData.m_Fat.fillAmount = fillAmount;
            float fillAmount2 = Player.Get().GetNutritionCarbo() / Player.Get().GetMaxNutritionCarbo();
            watchMacronutrientsData.m_Carbo.fillAmount = fillAmount2;
            float fillAmount3 = Player.Get().GetNutritionProtein() / Player.Get().GetMaxNutritionProtein();
            watchMacronutrientsData.m_Proteins.fillAmount = fillAmount3;
            float fillAmount4 = Player.Get().GetHydration() / Player.Get().GetMaxHydration();
            watchMacronutrientsData.m_Hydration.fillAmount = fillAmount4;
            return;
        }

        case Watch.State.Compass:
        {
            WatchCompassData watchCompassData = (WatchCompassData)this.m_Datas[3];
            Vector3          forward          = Player.Get().gameObject.transform.forward;
            float            num7             = Vector3.Angle(Vector3.forward, forward);
            if (forward.x < 0f)
            {
                num7 = 360f - num7;
            }
            Quaternion rotation = Quaternion.Euler(new Vector3(0f, 0f, num7));
            watchCompassData.m_Compass.transform.rotation = rotation;
            int num8 = 0;
            int num9 = 0;
            Player.Get().GetGPSCoordinates(out num8, out num9);
            watchCompassData.m_GPSCoordinates.text = num8.ToString() + "'W\n" + num9.ToString() + "'S";
            return;
        }

        default:
            return;
        }
    }