Пример #1
0
    // Use this for initialization
    void Start()
    {
        // Get Flat Calendar Instance
        //获取平面日历实例
        flatCalendar = GameObject.Find("FlatCalendar").GetComponent <FlatCalendar>();

        // Initialize Flat Calendar
        //初始化平日历
        flatCalendar.initFlatCalendar();

        // Install Demo Event List
        //安装演示事件列表
        flatCalendar.installDemoData();

        // Add Events Callbacks
        //添加事件回调
        flatCalendar.setCallback_OnDaySelected(dayUpdated);
        flatCalendar.setCallback_OnMonthChanged(monthUpdated);
        flatCalendar.setCallback_OnEventSelected(eventsDiscovered);
        flatCalendar.setCallback_OnNowday(backHome);

        // Set UI Style
        //设置UI样式
        flatCalendar.setUIStyle(1);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        // Get Flat Calendar Instance
        flatCalendar = GameObject.Find("FlatCalendar").GetComponent <FlatCalendar>();

        // Initialize Flat Calendar
        flatCalendar.initFlatCalendar();

        // Install Demo Event List
        flatCalendar.installDemoData();

        // Add Events Callbacks
        flatCalendar.setCallback_OnDaySelected(dayUpdated);
        flatCalendar.setCallback_OnMonthChanged(monthUpdated);
        flatCalendar.setCallback_OnEventSelected(eventsDiscovered);
        flatCalendar.setCallback_OnNowday(backHome);

        // Set UI Style
        flatCalendar.setUIStyle(1);

        // Add Event Demo
        EventObj demoEvent = new EventObj("Event Name", "Event Description");

        flatCalendar.addEvent(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, demoEvent);
    }
Пример #3
0
        // -------------------------------------------

        /*
         * Constructor
         */
        public override void Initialize(params object[] _list)
        {
            double timestampDate = DateConverter.GetTimestamp();

            if (_list.Length > 0)
            {
                if (_list[0] is string)
                {
                    string bufferData = (string)_list[0];
                    if (bufferData.Length > 0)
                    {
                        if (!double.TryParse(bufferData, out timestampDate))
                        {
                            timestampDate = DateConverter.GetTimestamp();
                        }
                    }
                }
            }

            // INIT CALENDAR
            m_flatCalendar = GameObject.Find("FlatCalendar").GetComponent <FlatCalendar>();
            m_myDateTime   = DateConverter.TimeStampToDateTime(timestampDate);
            m_flatCalendar.initFlatCalendar();
            m_flatCalendar.setCallback_OnDaySelected(DayUpdated);
            m_flatCalendar.setUIStyle(0);
            UIEventController.Instance.DelayUIEvent(UIEventController.EVENT_BASICEVENT_DELAYED_CALL, 0.01f, this.gameObject, "SetRequestDate");

            UIEventController.Instance.UIEvent += new UIEventHandler(OnBasicEvent);
        }
 public static void SetMyTime(this FlatCalendar _calendar, System.DateTime _date)
 {
     _calendar.currentTime.year      = _date.Year;
     _calendar.currentTime.month     = _date.Month;
     _calendar.currentTime.day       = _date.Day;
     _calendar.currentTime.dayOfWeek = _date.DayOfWeek.ToString();
     _calendar.currentTime.totalDays = System.DateTime.DaysInMonth(_calendar.currentTime.year, _calendar.currentTime.month);
     _calendar.currentTime.dayOffset = GetIndexOfFirstSlotInMonth(_calendar.currentTime.year, _calendar.currentTime.month);
     _calendar.updateCalendar(_calendar.currentTime.month, _calendar.currentTime.year);
     _calendar.markSelectionDay(_calendar.currentTime.day);
 }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        // Get Flat Calendar Instance
        flatCalendar = GameObject.Find("FlatCalendar").GetComponent <FlatCalendar>();

        // Initialize Flat Calendar
        flatCalendar.initFlatCalendar();

        // Install Demo Event List
        //flatCalendar.installDemoData();

        // Add Events Callbacks
        flatCalendar.setCallback_OnDaySelected(dayUpdated);
        flatCalendar.setCallback_OnMonthChanged(monthUpdated);
        flatCalendar.setCallback_OnEventSelected(eventsDiscovered);
        flatCalendar.setCallback_OnNowday(backHome);

        // Set UI Style
        flatCalendar.setUIStyle(1);
    }
Пример #6
0
    public static void changeUIStyle(int style)
    {
        // ======================================================
        // =================== GREEN SEA ========================
        // ======================================================
        if (style == (int)FlatCalendarStyle.COLORS_TYPE.GREEN_SEA)
        {
            color_header                = new Color(0.0f / 255.0f, 112.0f / 255.0f, 113.0f / 255.0f, 255.0f / 255.0f);
            color_subheader             = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 100.0f / 255.0f);
            color_body                  = new Color(0.0f / 255.0f, 125.0f / 255.0f, 126.0f / 255.0f, 255.0f / 255.0f);
            color_footer                = new Color(67.0f / 255.0f, 77.0f / 255.0f, 87.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextNormal         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextEvent          = new Color(0.0f / 255.0f, 112.0f / 255.0f, 113.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleEvent           = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleSelectionMarker = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_numberEvent           = new Color(238.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 255.0f / 255.0f);
            color_year                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_month                 = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_day         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);;
            color_dayOfWeek   = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Events      = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonRight = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonLeft  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Home        = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
        }

        // ======================================================
        // =================== RED CARPET =======================
        // ======================================================
        if (style == (int)FlatCalendarStyle.COLORS_TYPE.RED_CARPET)
        {
            color_header                = new Color(210.0f / 255.0f, 26.0f / 255.0f, 53.0f / 255.0f, 255.0f / 255.0f);
            color_subheader             = new Color(122.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 100.0f / 255.0f);
            color_body                  = new Color(184.0f / 255.0f, 28.0f / 255.0f, 62.0f / 255.0f, 255.0f / 255.0f);
            color_footer                = new Color(67.0f / 255.0f, 77.0f / 255.0f, 87.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextNormal         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextEvent          = new Color(210.0f / 255.0f, 26.0f / 255.0f, 53.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleEvent           = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleSelectionMarker = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_numberEvent           = new Color(238.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 255.0f / 255.0f);
            color_year                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_month                 = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_day         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);;
            color_dayOfWeek   = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Events      = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonRight = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonLeft  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Home        = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
        }

        // ======================================================
        // =================== ORANGE JUICE =====================
        // ======================================================
        if (style == (int)FlatCalendarStyle.COLORS_TYPE.ORANGE_JUICE)
        {
            color_header                = new Color(255.0f / 255.0f, 108.0f / 255.0f, 28.0f / 255.0f, 255.0f / 255.0f);
            color_subheader             = new Color(160.0f / 255.0f, 193.0f / 255.0f, 83.0f / 255.0f, 255.0f / 255.0f);
            color_body                  = new Color(240.0f / 255.0f, 89.0f / 255.0f, 7.0f / 255.0f, 255.0f / 255.0f);
            color_footer                = new Color(67.0f / 255.0f, 77.0f / 255.0f, 87.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextNormal         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextEvent          = new Color(255.0f / 255.0f, 108.0f / 255.0f, 28.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleEvent           = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleSelectionMarker = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_numberEvent           = new Color(238.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 255.0f / 255.0f);
            color_year                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_month                 = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_day         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);;
            color_dayOfWeek   = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Events      = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonRight = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonLeft  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Home        = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
        }

        // ======================================================
        // =================== GOOGLE MATERIAL ==================
        // ======================================================
        if (style == (int)FlatCalendarStyle.COLORS_TYPE.GOOGLE_MATERIAL)
        {
            color_header                = new Color(33.0f / 255.0f, 150.0f / 255.0f, 243.0f / 255.0f, 255.0f / 255.0f);
            color_subheader             = new Color(0.0f / 255.0f, 112.0f / 255.0f, 128.0f / 255.0f, 255.0f / 255.0f);
            color_body                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_footer                = new Color(67.0f / 255.0f, 77.0f / 255.0f, 87.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextNormal         = new Color(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextEvent          = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleEvent           = new Color(21.0f / 255.0f, 101.0f / 255.0f, 192.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleSelectionMarker = new Color(21.0f / 255.0f, 101.0f / 255.0f, 192.0f / 255.0f, 255.0f / 255.0f);
            color_numberEvent           = new Color(238.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 255.0f / 255.0f);
            color_year                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_month                 = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_day         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);;
            color_dayOfWeek   = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Events      = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonRight = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonLeft  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Home        = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
        }


        // ======================================================
        // =================== USER_MADE ==================
        // ======================================================
        if (style == (int)FlatCalendarStyle.COLORS_TYPE.GOOGLE_MATERIAL)
        {
            color_header                = new Color(111.0f / 255.0f, 103.0f / 255.0f, 103.0f / 255.0f, 255.0f / 255.0f);
            color_subheader             = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_body                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_footer                = new Color(111.0f / 255.0f, 103.0f / 255.0f, 103.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextNormal         = new Color(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
            color_dayTextEvent          = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleEvent           = new Color(21.0f / 255.0f, 101.0f / 255.0f, 192.0f / 255.0f, 255.0f / 255.0f);
            color_bubbleSelectionMarker = new Color(21.0f / 255.0f, 101.0f / 255.0f, 192.0f / 255.0f, 255.0f / 255.0f);
            color_numberEvent           = new Color(238.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 255.0f / 255.0f);
            color_year                  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_month                 = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_day         = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);;
            color_dayOfWeek   = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Events      = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonRight = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_ButtonLeft  = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
            color_Home        = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
        }

        /* Change Colors */
        GameObject.Find("Header").GetComponent <Image>().color    = color_header;
        GameObject.Find("SubHeader").GetComponent <Image>().color = color_subheader;
        GameObject.Find("Body").GetComponent <Image>().color      = color_body;
        GameObject.Find("Footer").GetComponent <Image>().color    = color_footer;
        GameObject.Find("Year").GetComponent <Text>().color       = color_year;
        GameObject.Find("Month").GetComponent <Text>().color      = color_month;
        GameObject.Find("Day_Title1").GetComponent <Text>().color = color_day;
        GameObject.Find("Day_Title2").GetComponent <Text>().color = color_dayOfWeek;
        //GameObject.Find("NumberEvents").GetComponent<Text>().color  = color_numberEvent;
        //GameObject.Find("Events").GetComponent<Text>().color        = color_Events;
        GameObject.Find("Left_btn").GetComponent <Image>().color     = color_ButtonLeft;
        GameObject.Find("Right_btn").GetComponent <Image>().color    = color_ButtonRight;
        GameObject.Find("Calendar_Btn").GetComponent <Image>().color = color_Home;

        /* Change Text Color */
        if (Application.isPlaying)
        {
            GameObject   obj = GameObject.Find("FlatCalendar");
            FlatCalendar f   = obj.GetComponent <FlatCalendar>();
            f.setCurrentTime();
            f.updateCalendar(f.currentTime.month, f.currentTime.year);
            f.markSelectionDay(f.currentTime.day);
        }
    }