Exemple #1
0
    //
    void Awake()
    {
        _toggle = GetComponent <Toggle>();
        if (null == _toggle)
        {
            Log.Error("not found toggle");
            return;
        }

        _toggle.onValueChanged.AddListener(onValueChanged);

        _schedule = Manager.Instance.Object.NurtureMode.Schedule;
        _schedule.InsertEvent.Attach(onScheduleInserted);
    }
    void Awake()
    {
        if (null != PrefCalendarPanel)
        {
            GameObject o = Instantiate(PrefCalendarPanel);
            o.transform.SetParent(transform, false);
            o.transform.SetAsFirstSibling();
        }
        else
        {
            Log.Error("not found prefab calendar panel");
        }

        _statPanelList = new List <StatPanel>();
        for (int i = 0; i < DEFAULT_NUM_STAT_PANEL; ++i)
        {
            GameObject o = Instantiate(PrefStatPanel);
            o.transform.SetParent(StatsPanel.transform, false);

            StatPanel p = o.GetComponent <StatPanel>();
            _statPanelList.Add(p);
        }

        _backgroundImage = GetComponent <Image>();
        _animController  = AnimImage.GetComponent <RunScheduleAnimController>();

        _schedule = Manager.Instance.Object.NurtureMode.Schedule;
        _schedule.ActionCancelEvent.Attach(onActionCancel);
        _schedule.ActionStartEvent.Attach(onActionStart);
        _schedule.ActionFirstEvent.Attach(onActionFirst);
        _schedule.ActionFirstEvent.Attach(onActionFirstNPC);
        _schedule.ActionDoEvent.Attach(onActionDo);
        _schedule.ActionDoEvent.Attach(onActionDoResult);
        _schedule.ActionBeforeEndEvent.Attach(onActionBeforeEnd);
        _schedule.ActionBeforeEndEvent.Attach(onActionBeforeEndExam);
        _schedule.ActionEndEvent.Attach(onActionEnd);
        _schedule.ActionEndEvent.Attach(onActionEndAchievement);

        Nurture.Mode nurtureMode = Manager.Instance.Object.NurtureMode;
        nurtureMode.Schedule.StartEvent.Attach(onScheduleStart);
        nurtureMode.Schedule.EndEvent.Attach(onScheduleEnd);
    }