Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
            Debug.Log(m_eStep);
        }

        if (m_iTabIndex == 4 && m_bDisp == false)
        {
            m_bDisp = true;
            if (0 == m_bannerScrollParen.m_childList.Count)
            {
                m_sprHospital.gameObject.SetActive(m_bDisp);
            }
        }
        else if (m_bDisp == true && m_iTabIndex != 4)
        {
            m_bDisp = false;
            m_sprHospital.gameObject.SetActive(m_bDisp);
        }
        else
        {
        }

        switch (m_eStep)
        {
        case STEP.IDLE:
            if (bInit)
            {
                if (m_csKatazukeCheck != null)
                {
                    Destroy(m_csKatazukeCheck.gameObject);
                    m_csKatazukeCheck = null;
                }

                m_pageHeader.TriggerClear();
            }
            displayAutoUpdate(ITEM_DETAIL_TABS);

            if (m_pageHeader.ButtonPushed)
            {
                m_eStep = STEP.KATAZUKE_CHECK;
            }
            break;

        case STEP.KATAZUKE_CHECK:
            if (bInit)
            {
                GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefKatazukeCheck", gameObject);
                m_csKatazukeCheck = obj.GetComponent <CtrlKatazukeCheck> ();
                m_csKatazukeCheck.Initialize();
            }
            if (m_csKatazukeCheck.YesOrNo.IsYes())
            {
                m_eStep = STEP.KATAZUKE;
            }
            else if (m_csKatazukeCheck.YesOrNo.IsNo())
            {
                m_eStep = STEP.IDLE;
            }
            else
            {
                ;                // なにもしない
            }
            break;

        case STEP.KATAZUKE:
            if (bInit)
            {
            }

            // 消す予定のところに新しい土地を設置する
            for (int x = m_dataItem.x; x < m_dataItem.x + m_dataItem.width; x++)
            {
                for (int y = m_dataItem.y; y < m_dataItem.y + m_dataItem.height; y++)
                {
                    GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefFieldItem", GameMain.ParkRoot.gameObject);
                    obj.name = "fielditem_" + x.ToString() + "_" + y.ToString();
                    CtrlFieldItem script = obj.GetComponent <CtrlFieldItem> ();
                    script.Init(x, y, 0);
                    GameMain.ParkRoot.m_fieldItemList.Add(script);
                }
            }

            GameMain.dbItem.Update(GameMain.Instance.m_iSettingItemSerial, 0, 0, 0);

            int iRemoveIndex = 0;
            foreach (CtrlFieldItem item in GameMain.ParkRoot.m_fieldItemList)
            {
                if (item.m_dataItem.item_serial == GameMain.Instance.m_iSettingItemSerial)
                {
                    item.Remove();
                    GameMain.ParkRoot.m_fieldItemList.RemoveAt(iRemoveIndex);
                    break;
                }
                iRemoveIndex += 1;
            }

            // 取り除く
            m_itemDetailBase.Remove();

            int             iUriagePerHour = 0;
            List <DataItem> item_list      = GameMain.dbItem.Select(" item_serial != 0 ");
            foreach (DataItem item in item_list)
            {
                iUriagePerHour += item.GetUriagePerHour();
            }
            GameMain.dbKvs.WriteInt(Define.USER_URIAGE_PAR_HOUR, iUriagePerHour);

            // 仕事の確認
            DataWork.WorkCheck();
            GameMain.Instance.HeaderRefresh();
            GameMain.ParkRoot.ConnectingRoadCheck();

            // 片付けして戻る
            m_closeButton.Close();
            Destroy(m_csKatazukeCheck.gameObject);
            m_csKatazukeCheck = null;
            break;

        default:
            break;
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
        }

        switch (m_eStep)
        {
        case STEP.IDLE:
            if (bInit)
            {
                if (m_csKatazukeCheck != null)
                {
                    Destroy(m_csKatazukeCheck.gameObject);
                    m_csKatazukeCheck = null;
                }

                m_pageHeader.TriggerClear();
            }
            displayAutoUpdate(ITEM_DETAIL_TABS);

            if (m_pageHeader.ButtonPushed)
            {
                m_eStep = STEP.KATAZUKE_CHECK;
            }
            break;

        case STEP.KATAZUKE_CHECK:
            if (bInit)
            {
                GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefKatazukeCheck", gameObject);
                m_csKatazukeCheck = obj.GetComponent <CtrlKatazukeCheck> ();
                m_csKatazukeCheck.Initialize();
            }
            if (m_csKatazukeCheck.YesOrNo.IsYes())
            {
                m_eStep = STEP.KATAZUKE;
            }
            else if (m_csKatazukeCheck.YesOrNo.IsNo())
            {
                m_eStep = STEP.IDLE;
            }
            else
            {
                ;                // なにもしない
            }
            break;

        case STEP.KATAZUKE:
            if (bInit)
            {
            }

            List <DataStaff> staff_list = GameMain.dbStaff.Select(" office_serial = " + GameMain.Instance.m_iSettingItemSerial.ToString());

            Dictionary <string, string> dict = new Dictionary <string, string> ();
            dict.Add("office_serial", "0");
            dict.Add("item_serial", "0");
            foreach (DataStaff staff in staff_list)
            {
                CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(staff.item_serial);
                fielditem.RemoveStaff(staff.staff_serial);
                GameMain.dbStaff.Update(staff.staff_serial, dict);
            }

            // 上のスタッフを削除したとにしてください
            Debug.Log(GameMain.Instance.m_iSettingItemSerial);
            CtrlFieldItem ctrlFieldItem = GameMain.ParkRoot.GetFieldItem(GameMain.Instance.m_iSettingItemSerial);
            for (int x = m_dataItem.x; x < m_dataItem.x + m_dataItem.width; x++)
            {
                for (int y = m_dataItem.y; y < m_dataItem.y + m_dataItem.height; y++)
                {
                    GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefFieldItem", GameMain.ParkRoot.gameObject);
                    obj.name = "fielditem_" + x.ToString() + "_" + y.ToString();
                    CtrlFieldItem script = obj.GetComponent <CtrlFieldItem> ();
                    script.Init(x, y, 0);
                    GameMain.ParkRoot.m_fieldItemList.Add(script);
                }
            }
            ctrlFieldItem.Remove();

            GameMain.dbItem.Update(GameMain.Instance.m_iSettingItemSerial, 0, 0, 0);
            int iRemoveIndex = 0;
            foreach (CtrlFieldItem item in GameMain.ParkRoot.m_fieldItemList)
            {
                if (item.m_dataItem.item_serial == GameMain.Instance.m_iSettingItemSerial)
                {
                    GameMain.ParkRoot.m_fieldItemList.RemoveAt(iRemoveIndex);
                    break;
                }
                iRemoveIndex += 1;
            }

            // 取り除く
            if (m_itemDetailBase != null)
            {
                m_itemDetailBase.Remove();
            }
            // 片付けして戻る
            m_closeButton.Close();
            Destroy(m_csKatazukeCheck.gameObject);
            m_csKatazukeCheck = null;

            // 仕事の確認
            DataWork.WorkCheck();
            GameMain.Instance.HeaderRefresh();


            break;

        default:
            break;
        }
    }