Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        string strPrefab = "prefab/PrefItemDetailDisp";

        bool bInit = false;

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

        switch (m_eStep)
        {
        case STEP.IDLE:
            if (bInit)
            {
                m_buttonBase.TriggerClear();
            }
            if (m_buttonBase.ButtonPushed)
            {
                m_buttonBase.TriggerClear();
                Debug.Log("clicked:BannerBase.Mode=" + BannerBase.Mode.ToString());

                if (m_bAbleUse)
                {
                    switch (BannerBase.Mode)
                    {
                    case BannerBase.MODE.STAFF_SET_BUY:
                        m_eStep = STEP.SETTING;
                        break;

                    case BannerBase.MODE.STAFF_SET_MINE:
                        m_eStep = STEP.SETTING;
                        break;

                    case BannerBase.MODE.STAFF_BACKYARD_CHECK:
                        m_eStep = STEP.BACKYARD_CHECK;
                        break;

                    default:
                        break;
                    }
                }
            }
            break;

        case STEP.SETTING:
            if (bInit)
            {
                // この作り方はいただけませんねぇ・・・
                GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefStaffSetting", gameObject);
                m_staffSetting = obj.GetComponent <CtrlStaffSetting> ();

                Debug.Log(m_staffSetting);

                // ここで取得するっていうのもなんか良くないっすね
                DataItem officeData = GameMain.dbItem.Select(GameMain.Instance.m_iSettingItemSerial);

                Debug.Log(officeData);
                Debug.Log(m_dataStaff.staff_id);
                Debug.Log(m_dataStaff.staff_serial);

                Debug.Log(m_staffSetting);
                m_staffSetting.Initialize(officeData, m_dataStaff.staff_id, m_dataStaff.staff_serial);
            }
            if (m_staffSetting.IsEnd())
            {
                m_staffSetting.Close();
                Destroy(m_staffSetting.gameObject);
                m_staffSetting = null;
                m_eStep        = STEP.IDLE;
            }
            break;

        case STEP.BACKYARD_CHECK:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();
                m_ojisanCheck.Initialize("こちらのスタッフを\n待機室へ\n移動させます。");
            }
            if (m_ojisanCheck.IsYes())
            {
                GameMain.ListRefresh = true;
                m_eStep = STEP.BACKYARD;
            }
            else if (m_ojisanCheck.IsNo())
            {
                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            else
            {
            }
            break;

        case STEP.BACKYARD:

            CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(m_dataStaff.item_serial);
            field_item.RemoveStaff(m_dataStaff.staff_serial);

            Dictionary <string, string> dict = new Dictionary <string, string> ();
            dict.Add("office_serial", 0.ToString ());
            dict.Add("item_serial", 0.ToString ());
            //dict.Add ("setting_time", "\"" + strNow + "\"");
            GameMain.dbStaff.Update(m_dataStaff.staff_serial, dict);

            CsvStaffData staff_data = DataManager.GetStaff(m_dataStaff.staff_id);
            GameMain.Instance.m_iCostNokori += staff_data.cost;

            GameMain.ListRefresh = true;

            m_eStep = STEP.IDLE;
            // 仕事の確認
            DataWork.WorkCheck();
            GameMain.Instance.HeaderRefresh();
            // バックヤードに戻す場合はこっちでおじさんをけすd
            Destroy(m_ojisanCheck.gameObject);

            break;

        default:
            break;
        }
    }
Exemplo n.º 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)
            {
                m_buttonBase.TriggerClear();
            }
            if (m_buttonBase.ButtonPushed)
            {
                m_buttonBase.TriggerClear();

                if (m_bAbleUse)
                {
                    Debug.Log("clicked:BannerBase.Mode=" + BannerBase.Mode.ToString());
                    //SoundManager.Instance.PlaySE (SoundName.BUTTON_PUSH);

                    switch (BannerBase.Mode)
                    {
                    case BannerBase.MODE.MONSTER_DETAIL:
                        m_eStep = STEP.DETAIL;
                        break;

                    case BannerBase.MODE.MONSTER_SET_BUY:
                        m_eStep = STEP.SET_BUY;
                        break;

                    case BannerBase.MODE.MONSTER_SET_MINE:
                        m_eStep = STEP.SET_MINE;
                        break;

                    case BannerBase.MODE.MONSTER_SICK:
                        m_eStep = STEP.SICK;
                        break;

                    default:
                        break;
                    }
                }
            }
            break;

        case STEP.DETAIL:
            if (bInit)
            {
                SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH);
                // この作り方はいただけませんねぇ・・・
                GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefMonsterDetail", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_monsterDetail = obj.GetComponent <CtrlMonsterDetail> ();
                m_monsterDetail.Initialize(m_dataMonster.monster_serial);
            }
            if (m_monsterDetail.IsEnd())
            {
                SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH);

                Destroy(m_monsterDetail.gameObject);
                m_monsterDetail = null;
                m_eStep         = STEP.IDLE;
            }
            break;

        case STEP.SET_BUY:
            if (bInit)
            {
                SoundManager.Instance.PlaySE(SoundName.SET_ANIMAL);

                CsvMonsterData monster_data = DataManager.GetMonster(m_dataMonsterMaster.monster_id);
                if (0 < monster_data.coin)
                {
                    DataManager.user.AddGold(-1 * monster_data.coin);
                }
                else if (0 < monster_data.ticket)
                {
                    DataManager.user.AddTicket(-1 * monster_data.ticket);
                }
                else
                {
                    ;                    // エラーちゃう?
                }

                // 0番のページに飛ばす
                DataMonster insertMonster = GameMain.dbMonster.Insert(m_dataMonsterMaster.monster_id, GameMain.Instance.m_iSettingItemSerial);

                m_tabParent.TriggerOn(0);

                CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(GameMain.Instance.m_iSettingItemSerial);
                GameObject    objIcon   = PrefabManager.Instance.MakeObject("prefab/PrefIcon", fielditem.gameObject);
                CtrlIconRoot  iconRoot  = objIcon.GetComponent <CtrlIconRoot> ();
                iconRoot.Initialize(insertMonster, fielditem);
                fielditem.Add(iconRoot);

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

                if (0 < GameMain.Instance.TutorialMonster)
                {
                    TutorialManager.Instance.Next();
                    GameMain.Instance.TutorialMonster = 0;
                }
            }
            break;

        case STEP.SET_MINE:
            if (bInit)
            {
                SoundManager.Instance.PlaySE(SoundName.SET_ANIMAL);
                Dictionary <string, string> dict = new Dictionary <string, string> ();
                dict.Add("item_serial", GameMain.Instance.m_iSettingItemSerial.ToString());
                dict.Add("collect_time", "\"" + TimeManager.StrNow() + "\"");

                GameMain.dbMonster.Update(m_dataMonster.monster_serial, dict);
                //GameMain.dbMonster.Update (m_dataMonster.monster_serial, GameMain.Instance.m_iSettingItemSerial);

                m_tabParent.TriggerOn(0);

                DataMonster   insertMonster = GameMain.dbMonster.Select(m_dataMonster.monster_serial);
                CtrlFieldItem fielditem     = GameMain.ParkRoot.GetFieldItem(GameMain.Instance.m_iSettingItemSerial);
                GameObject    objIcon       = PrefabManager.Instance.MakeObject("prefab/PrefIcon", fielditem.gameObject);
                CtrlIconRoot  iconRoot      = objIcon.GetComponent <CtrlIconRoot> ();
                iconRoot.Initialize(insertMonster, fielditem);
                fielditem.Add(iconRoot);

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

        case STEP.SICK:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);

                CsvMonsterData monster = DataManager.GetMonster(m_dataMonster.monster_id);

                int iCost = monster.revenew_coin * (int)(600.0f / (float)monster.revenew_interval);

                bool   bYesOnly = false;
                string strText  = string.Format("こちらの動物を\n治療しますか\n\n治療費:{0}G\n\n{1}G → [FFD900]{2}[-]G", iCost, DataManager.user.m_iGold, DataManager.user.m_iGold - iCost);
                if (DataManager.user.m_iGold < iCost)
                {
                    bYesOnly = true;
                    strText  = string.Format("こちらの動物を\n治療しますか\n治療費:{0}G\n\n[FFD900]GOLDが足りません[-]", iCost);
                }

                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();
                m_ojisanCheck.Initialize(strText, bYesOnly);
            }
            if (m_ojisanCheck.IsYes())
            {
                SoundManager.Instance.PlaySE("se_cure");
                CsvMonsterData monster = DataManager.GetMonster(m_dataMonster.monster_id);
                int            iCost   = monster.revenew_coin * (int)(600.0f / (float)monster.revenew_interval);
                DataManager.user.AddGold(-1 * iCost);

                GameMain.ListRefresh = true;
                Destroy(m_ojisanCheck.gameObject);

                Dictionary <string, string> dict = new Dictionary <string, string> ();
                int iConditionFine = (int)Define.Monster.CONDITION.FINE;
                dict.Add("condition", iConditionFine.ToString());
                dict.Add("clean_time", string.Format("\"{0}\" ", TimeManager.StrGetTime()));
                Debug.Log(TimeManager.StrGetTime());
                GameMain.dbMonster.Update(m_dataMonster.monster_serial, dict);
                m_eStep = STEP.IDLE;
            }
            else if (m_ojisanCheck.IsNo())
            {
                SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH);

                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            else
            {
            }
            break;

        case STEP.SET_CAGE:
            break;

        case STEP.MAX:
        default:
            break;
        }
    }
Exemplo n.º 3
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;
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        //m_fTimer += Time.deltaTime;
        if (10.0f < m_fTimer)
        {
            m_bIsEnd = true;
        }

        if (m_buttonYesNo.IsYes())
        {
            m_bIsEnd = true;
            DataStaff staff;
            int       iStaffCost = 0;
            if (0 < m_iSetStaffSerial)
            {
                //GameMain.dbStaff.Update(
                Debug.Log(string.Format("set staff from backyard:{0}", m_iSetStaffSerial));
                string strNow = TimeManager.StrNow();
                Dictionary <string, string> dict = new Dictionary <string, string> ();
                dict.Add("office_serial", m_dataOffice.item_serial.ToString());
                dict.Add("item_serial", m_dispOffice.SelectingCageSerial.ToString());
                dict.Add("setting_time", "\"" + strNow + "\"");
                staff = GameMain.dbStaff.Update(m_iSetStaffSerial, dict);

                CsvStaffData staff_data = DataManager.GetStaff(m_iSetStaffId);
                iStaffCost = staff_data.coin;
            }
            else
            {
                staff = GameMain.dbStaff.Insert(m_iSetStaffId, m_dataOffice.item_serial, m_dispOffice.SelectingCageSerial);

                CsvStaffData staff_data = DataManager.GetStaff(m_iSetStaffId);
                if (0 < staff_data.coin)
                {
                    DataManager.user.AddGold(-1 * staff_data.coin);
                }
                else if (0 < staff_data.ticket)
                {
                    DataManager.user.AddTicket(-1 * staff_data.ticket);
                }
                else
                {
                    ;                    // エラーちゃう?
                }
                iStaffCost = staff_data.cost;
            }

            CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(m_dispOffice.SelectingCageSerial);
            GameObject    objIcon   = PrefabManager.Instance.MakeObject("prefab/PrefIcon", fielditem.gameObject);
            CtrlIconRoot  iconRoot  = objIcon.GetComponent <CtrlIconRoot> ();
            iconRoot.Initialize(staff, fielditem);
            fielditem.Add(iconRoot);

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

            GameMain.Instance.m_iCostNokori -= iStaffCost;
        }
        else if (m_buttonYesNo.IsNo())
        {
            m_bIsEnd = true;
        }
        else
        {
            ;            //
        }

        m_iSelectingCageSerial = m_dispOffice.SelectingCageSerial;

        if (m_iSelectingCageSerialPre != m_iSelectingCageSerial)
        {
            if (0 < m_iSelectingCageSerialPre)
            {
                CtrlFieldItem script = GameMain.ParkRoot.GetFieldItem(m_iSelectingCageSerialPre);
                script.SetColor(Color.white);
            }
            if (0 < m_iSelectingCageSerial)
            {
                m_buttonYesNo.EnableButtonYes(true);

                CtrlFieldItem script = GameMain.ParkRoot.GetFieldItem(m_iSelectingCageSerial);
                script.SetColor(Color.red);
                m_iSelectingCageSerialPre = m_iSelectingCageSerial;
            }
        }
    }
Exemplo n.º 5
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);
        }

        switch (m_eStep)
        {
        case STEP.SETUP_DB:
            if (bInit)
            {
            }
            if (GameMain.Instance.IsIdle())
            {
                m_eStep = STEP.SETUP;
            }
            break;

        case STEP.SETUP:
            if (bInit)
            {
                m_csFieldItemList.Clear();
                DataManager.Instance.m_ItemDataList = GameMain.dbItem.Select(" status != 0 ");
                //Debug.LogError (DataManager.Instance.m_ItemDataList.Count);
                m_csParkRoot.Initialize(DataManager.Instance.m_ItemDataList);
                m_csParkRoot.ConnectingRoadCheck();

                // ここで仕事のチェックしますか
                DataWork.WorkCheck();
            }
            if (InputManager.Instance.m_TouchInfo.TouchON)
            {
                m_eStep = STEP.IDLE;
            }

            if (GameMain.Instance.m_bStartSetting)
            {
                m_eStep = STEP.SETTING_ITEM;
            }
            else
            {
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.IDLE:
            if (bInit)
            {
                SoundManager.Instance.PlayBGM(SoundName.BGM_MAIN);

                m_eEditMode = ParkMain.EDIT_MODE.NORMAL;
                m_footer.gameObject.SetActive(true);

                if (m_parkMainController != null)
                {
                    m_parkMainController.enabled = false;
                }
                m_parkMainController = GetComponent <ParkMainIdle> () as ParkMainController;
                if (m_parkMainController == null)
                {
                    m_parkMainController = gameObject.AddComponent <ParkMainIdle> () as ParkMainController;
                }
                m_parkMainController.Initialize(this);
            }
            if (m_parkMainController.IsEnd())
            {
                m_eEditMode = ParkMain.EDIT_MODE.MOVE;;
                m_eStep     = STEP.SETTING_ITEM;
            }
            break;

        case STEP.SETTING_ITEM:
            if (bInit)
            {
                // 念のため
                m_footer.gameObject.SetActive(false);

                if (m_parkMainController != null)
                {
                    m_parkMainController.enabled = false;
                }
                m_parkMainController = GetComponent <ParkMainSettingItem> () as ParkMainController;
                if (m_parkMainController == null)
                {
                    m_parkMainController = gameObject.AddComponent <ParkMainSettingItem> () as ParkMainController;
                }
                m_parkMainController.Initialize(this);
            }
            if (m_parkMainController.IsEnd())
            {
                m_parkMainController.Clear();
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (m_bIsEnd == false)
        {
            if (m_ButtonCollect.ButtonPushed)
            {
                // 消す予定のところに新しい土地を設置する
                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(m_iItemSerial, 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;
                }

                /*
                 * foreach (CtrlFieldItem script in m_csParkRoot.m_fieldItemList) {
                 *      if (script.m_dataItem.item_serial == m_iItemSerial) {
                 *
                 *              m_csParkRoot.m_fieldItemList.Remove (script);
                 *              Destroy (script.gameObject);
                 *              break;
                 *      }
                 * }
                 */
                // 仕事の確認
                DataWork.WorkCheck();
                GameMain.Instance.HeaderRefresh();

                m_csParkRoot.ConnectingRoadCheck();

                m_bIsEnd = true;
                SoundManager.Instance.PlaySE(SoundName.BUTTON_CANCEL);
            }
            else if (m_ButtonClose.ButtonPushed)
            {
                m_bIsEnd = true;
                SoundManager.Instance.PlaySE(SoundName.BUTTON_CANCEL);
            }
            else
            {
            }
        }
    }
Exemplo n.º 7
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)
            {
                m_buttonBase.TriggerClear();
            }

            if (m_buttonBase.ButtonPushed)
            {
                m_buttonBase.TriggerClear();
                if (m_dataWork.status == 1)
                {
                    if (0 < m_dataWork.mission_monster)
                    {
                        m_eStep = STEP.MONSTER_BUY_CHECK;
                    }
                    else if (0 < m_dataWork.mission_item)
                    {
                        DataItemMaster item_master = GameMain.dbItemMaster.Select(m_dataWork.mission_item);

                        if (item_master.status == (int)Define.Item.Status.NONE)
                        {
                            m_eStep = STEP.ITEM_HINT;
                        }
                        else
                        {
                            m_eStep = STEP.ITEM_MOVE;
                        }
                    }
                    else if (0 < m_dataWork.mission_staff)
                    {
                        m_eStep = STEP.STAFF_MOVE;
                    }
                    else
                    {
                    }
                }
            }
            break;

        case STEP.MONSTER_BUY_CHECK:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();

                CsvMonsterData monster_data = DataManager.GetMonster(m_dataWork.mission_monster);

                string strDisp = "";
                if (monster_data.coin <= DataManager.user.m_iGold)
                {
                    strDisp = string.Format("本当に購入しますか?\n({0}G)\n\n{1}G→[FFD900]{2}G[-]", monster_data.coin, DataManager.user.m_iGold, DataManager.user.m_iGold - monster_data.coin);
                    //strDisp = string.Format("こちらの動物を\n購入しますか({0}G)\n\n{1}G→{2}G" , monster_data.coin , DataManager.user.m_iGold , DataManager.user.m_iGold - monster_data.coin );
                }
                else
                {
                    strDisp = string.Format("こちらの動物を\n購入しますか\n\n購入には[FF0000]{0}G[-]必要です\n[FF0000]{1}G[-]不足しています", monster_data.coin, monster_data.coin - DataManager.user.m_iGold);
                    m_ojisanCheck.YesOrNo.EnableButtonYes(false);
                }

                m_ojisanCheck.Initialize(strDisp);
            }
            if (m_ojisanCheck.IsYes())
            {
                Destroy(m_ojisanCheck.gameObject);
                SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH);
                m_eStep = STEP.MONSTER_BUY;
            }
            else if (m_ojisanCheck.IsNo())
            {
                Destroy(m_ojisanCheck.gameObject);
                SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH);
                m_eStep = STEP.IDLE;
            }
            else
            {
            }

            break;

        case STEP.MONSTER_BUY:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();
                string strDisp = "購入完了しました\n檻から設置を\n行ってください\n";
                m_ojisanCheck.Initialize(strDisp, true);

                /*
                 * Dictionary< string , string > dict = new Dictionary< string , string > ();
                 * int iConditionFine = (int)Define.Monster.CONDITION.FINE;
                 * dict.Add( "condition" , iConditionFine.ToString() );
                 */
                GameMain.dbMonster.Insert(m_dataWork.mission_monster, 0);
                CsvMonsterData monster_data = DataManager.GetMonster(m_dataWork.mission_monster);

                DataManager.user.AddGold(monster_data.coin * -1);
                DataWork.WorkCheck();
            }
            if (m_ojisanCheck.IsYes())
            {
                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
                GameMain.ListRefresh = true;
            }
            break;

        case STEP.ITEM_HINT:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();

                DataItemMaster item_mission = GameMain.dbItemMaster.Select(m_dataWork.mission_item);
                DataItemMaster item_open    = GameMain.dbItemMaster.Select(item_mission.open_item_id);

                string strDisp = string.Format("HINT!\n\n{0}は\n[FF0000]{1}[-]を購入すると\n購入可能になります", item_mission.name, item_open.name);
                m_ojisanCheck.Initialize(strDisp, true);
            }
            if (m_ojisanCheck.IsYes())
            {
                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.ITEM_MOVE:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();


                string strDisp = string.Format("購入ページに移動します\nよろしいですか?");
                m_ojisanCheck.Initialize(strDisp);
            }
            if (m_ojisanCheck.IsYes())
            {
                Destroy(m_ojisanCheck.gameObject);

                DataItemMaster item_mission = GameMain.dbItemMaster.Select(m_dataWork.mission_item);
                switch (item_mission.category)
                {
                case 1:
                default:
                    GameMain.Instance.m_iMoveTab = 0;
                    break;

                case 2:
                    GameMain.Instance.m_iMoveTab = 1;
                    break;

                case 3:
                    GameMain.Instance.m_iMoveTab = 2;
                    break;
                }

                GameMain.Instance.SetStatus(GameMain.STATUS.ITEM);
                //m_eStep = STEP.IDLE;
            }
            else if (m_ojisanCheck.IsNo())
            {
                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            else
            {
            }
            break;

        case STEP.STAFF_MOVE:
            if (bInit)
            {
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject);
                m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> ();

                //string strDisp = string.Format("HINT!\n\nスタッフを雇う場合は\n檻を選択してから\n配置を行うことができます"  );
                string strDisp = string.Format("\n\nHINT!\n\nオフィス購入後、各施設の「配置」タブからスタッフを雇えるよ!\n\n");

                m_ojisanCheck.Initialize(strDisp, true);
            }
            if (m_ojisanCheck.IsYes())
            {
                Destroy(m_ojisanCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            break;

            break;

        case STEP.MAX:
        default:
            break;
        }
    }
Exemplo n.º 8
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)
            {
                m_fCheckTime     = 0.0f;
                m_fCheckInterval = 3.0f;
                m_lbLevel.text   = "Lv." + m_iLevel.ToString();

                SetExp(m_iLevel, out m_iLevelExpNow, out m_iLevelExpNext);
                m_fValue      = Define.GetValue(m_iTotalExp, m_iLevelExpNow, m_iLevelExpNext);
                m_slExp.value = m_fValue;
                m_lbAto.text  = (m_iLevelExpNext - m_iTotalExp).ToString();

                if (m_iLevel == Define.USER_LEVEL_MAX)
                {
                    m_lbAto.text = "[FF0000]MAX[-]";
                    m_lbAto.transform.localPosition = new Vector3(m_lbAto.transform.localPosition.x, 37.0f, m_lbAto.transform.localPosition.z);
                    m_lbMade.text = "";
                }

                m_iTotalExpTarget = GameMain.dbKvs.ReadInt(Define.USER_TOTAL_EXP);
                if (m_iLevelExpNext < m_iTotalExpTarget)
                {
                    m_iTotalExpTarget = m_iLevelExpNext;
                }
            }
            m_fCheckTime += Time.deltaTime;
            if (m_fCheckInterval < m_fCheckTime)
            {
                m_fCheckTime -= m_fCheckInterval;

                m_iTotalExpTarget = GameMain.dbKvs.ReadInt(Define.USER_TOTAL_EXP);
                if (m_iLevelExpNext < m_iTotalExpTarget)
                {
                    m_iTotalExpTarget = m_iLevelExpNext;
                }
                m_iDiff = m_iTotalExpTarget - m_iTotalExp;
            }

            if (m_iTotalExp < m_iTotalExpTarget)
            {
                int iAdd = Mathf.CeilToInt(m_iDiff * Time.deltaTime);
                m_iTotalExp += iAdd;
                if (m_iTotalExpTarget <= m_iTotalExp)
                {
                    m_iTotalExp = m_iTotalExpTarget;
                    if (m_iLevelExpNext <= m_iTotalExp)
                    {
                        m_eStep = STEP.LEVEL_UP;
                    }
                }
                m_fValue      = Define.GetValue(m_iTotalExp, m_iLevelExpNow, m_iLevelExpNext);
                m_slExp.value = m_fValue;
                m_lbAto.text  = (m_iLevelExpNext - m_iTotalExp).ToString();
            }
            break;

        case STEP.COUNT_UP:
            break;

        case STEP.LEVEL_UP:
            if (bInit)
            {
                m_fTime = 0.0f;
                m_PopupAnimation.Popup();
                SoundManager.Instance.PlaySE("se_levelup");
            }
            m_fTime += Time.deltaTime;

            if (0.5f < m_fTime)
            {
                m_eStep   = STEP.IDLE;
                m_iLevel += 1;
                GameMain.dbKvs.WriteInt(Define.USER_LEVEL, m_iLevel);
                DataWork.WorkCheck();
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
        return;
    }
Exemplo n.º 9
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;
        }
    }
Exemplo n.º 10
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);
        }

        switch (m_eStep)
        {
        case STEP.IDLE:
            if (bInit)
            {
                m_parkMain.m_bInputTrigger = false;
                InputManager.Instance.m_TouchInfo.TouchUp = false;

                // 更新
                DataManager.Instance.m_ItemDataList = GameMain.dbItem.Select(" status != 0 ");

                m_fLongTapTime  = 0.0f;
                m_bLongTapCheck = false;
                GameMain.Instance.BuildingSerial = 0;
            }

            if (0 < GameMain.Instance.SwitchItemSerial)
            {
                int iSelectSerial = GameMain.Instance.SwitchItemSerial;
                GameMain.Instance.m_iSettingItemSerial = iSelectSerial;
                GameMain.Instance.SwitchItemSerial     = 0;
                m_selectItem = GameMain.dbItem.Select(iSelectSerial);
                SoundManager.Instance.PlaySE(SoundName.BUTTON_SELECT);
                CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(iSelectSerial);
                GameMain.Instance.SetStatus(GameMain.STATUS.CAGE_DETAIL);
            }
            else if (GameMain.Instance.TutorialInputLock == true)
            {
                // チュートリアルの入力制限中はすぐ終わる
            }
            else if (InputManager.Instance.IsPinch())
            {
                m_eStep = STEP.PINCH;
            }
            else if (InputManager.Instance.m_TouchInfo.Swipe)
            {
                m_eStep = STEP.SWIPE;
            }
            else if (InputManager.Instance.m_TouchInfo.TouchUp)
            {
                InputManager.Instance.m_TouchInfo.TouchUp = false;
                int iGridX = 0;
                int iGridY = 0;

                if (GameMain.GetGrid(InputManager.Instance.m_TouchInfo.TouchPoint, out iGridX, out iGridY))
                {
                    int iSelectSerial = 0;

                    if (0 < GameMain.Instance.BuildingSerial)
                    {
                        iSelectSerial = GameMain.Instance.BuildingSerial;
                        GameMain.Instance.BuildingSerial = 0;
                    }
                    else
                    {
                        foreach (DataItem data_item in DataManager.Instance.m_ItemDataList)
                        {
                            if (GameMain.GridHit(iGridX, iGridY, data_item))
                            {
                                iSelectSerial = data_item.item_serial;
                            }
                        }
                    }

                    if (0 < iSelectSerial)
                    {
                        Debug.Log("hit:serial=" + iSelectSerial.ToString());

                        GameMain.Instance.m_iSettingItemSerial = iSelectSerial;
                        m_selectItem = GameMain.dbItem.Select(iSelectSerial);
                        int iCategory = m_selectItem.category;
                        if (iCategory == (int)Define.Item.Category.SHOP)
                        {
                            SoundManager.Instance.PlaySE(SoundName.BUTTON_SELECT);
                            CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(iSelectSerial);
                            if (field_item.IsReady())
                            {
                                m_iNokoriTime = field_item.GetNokoriTime();
                                m_eStep       = STEP.SPEED_BUILD_CHECK;
                            }
                            else
                            {
                                m_eStep = STEP.SHOP;
                            }
                        }
                        else if (iCategory == (int)Define.Item.Category.CAGE)
                        {
                            SoundManager.Instance.PlaySE(SoundName.BUTTON_SELECT);
                            CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(iSelectSerial);
                            if (field_item.IsReady())
                            {
                                m_iNokoriTime = field_item.GetNokoriTime();
                                m_eStep       = STEP.SPEED_BUILD_CHECK;
                            }
                            else
                            {
                                GameMain.Instance.SetStatus(GameMain.STATUS.CAGE_DETAIL);
                            }
                        }
                        else if (iCategory == (int)Define.Item.Category.OFFICE)
                        {
                            SoundManager.Instance.PlaySE(SoundName.BUTTON_SELECT);
                            CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(iSelectSerial);
                            if (field_item.IsReady())
                            {
                                m_iNokoriTime = field_item.GetNokoriTime();
                                m_eStep       = STEP.SPEED_BUILD_CHECK;
                            }
                            else
                            {
                                GameMain.Instance.SetStatus(GameMain.STATUS.OFFICE_DETAIL);
                            }
                        }
                        else
                        {
                        }
                        break;
                    }
                }
            }
            else if (m_parkMain.m_bInputTrigger == false && InputManager.Instance.m_TouchInfo.TouchON)
            {
                m_parkMain.m_bInputTrigger = true;
                Vector2 pos = InputManager.Instance.m_TouchInfo.TouchPoint;

                Vector2 offset = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f - 40.0f);

                Vector2 use = InputManager.Instance.m_TouchInfo.TouchPoint - offset;
            }
            else if (InputManager.Instance.m_TouchInfo.TouchON == false)
            {
                m_parkMain.m_bInputTrigger = false;
            }
            else if (InputManager.Instance.m_TouchInfo.TouchON && m_bLongTapCheck == false)
            {
                if (m_fLongTapTime < Define.LONG_TAP_TIME)
                {
                    m_fLongTapTime += Time.deltaTime;
                }
                else
                {
                    int iGridX = 0;
                    int iGridY = 0;
                    if (GameMain.GetGrid(InputManager.Instance.m_TouchInfo.TouchPoint, out iGridX, out iGridY))
                    {
                        int iSelectSerial = 0;
                        foreach (DataItem data_item in DataManager.Instance.m_ItemDataList)
                        {
                            if (GameMain.GridHit(iGridX, iGridY, data_item))
                            {
                                iSelectSerial = data_item.item_serial;
                            }
                        }
                        if (0 < iSelectSerial)
                        {
                            Debug.Log("hit:serial=" + iSelectSerial.ToString());

                            GameMain.Instance.m_iSettingItemSerial = iSelectSerial;
                            m_selectItem = GameMain.dbItem.Select(iSelectSerial);
                            int iCategory = m_selectItem.category;
                            if (iCategory == (int)Define.Item.Category.SHOP)
                            {
                            }
                            else if (iCategory == (int)Define.Item.Category.CAGE)
                            {
                            }
                            else if (iCategory == (int)Define.Item.Category.OFFICE)
                            {
                            }
                            else
                            {
                            }
                            m_eStep = STEP.END;
                            break;
                        }
                    }
                }
            }
            else
            {
            }

            break;

        case STEP.SWIPE:
            m_parkMain.goParkRoot.transform.localPosition += new Vector3(InputManager.Instance.m_TouchInfo.SwipeAdd.x, InputManager.Instance.m_TouchInfo.SwipeAdd.y, 0.0f);

            float fMaxX = (DataManager.user.m_iWidth) * Define.CELL_X_DIR.x;
            float fMinX = fMaxX * -1.0f;

            if (m_parkMain.goParkRoot.transform.localPosition.x < fMinX)
            {
                m_parkMain.goParkRoot.transform.localPosition = new Vector3(fMinX, m_parkMain.goParkRoot.transform.localPosition.y, m_parkMain.goParkRoot.transform.localPosition.z);
            }
            else if (fMaxX < m_parkMain.goParkRoot.transform.localPosition.x)
            {
                m_parkMain.goParkRoot.transform.localPosition = new Vector3(fMaxX, m_parkMain.goParkRoot.transform.localPosition.y, m_parkMain.goParkRoot.transform.localPosition.z);
            }
            else
            {
            }

            float fMaxY = 0.0f;
            float fMinY = (DataManager.user.m_iHeight * 2) * Define.CELL_X_DIR.y * -1.0f;
            if (m_parkMain.goParkRoot.transform.localPosition.y < fMinY)
            {
                m_parkMain.goParkRoot.transform.localPosition = new Vector3(m_parkMain.goParkRoot.transform.localPosition.x, fMinY, m_parkMain.goParkRoot.transform.localPosition.z);
            }
            else if (fMaxY < m_parkMain.goParkRoot.transform.localPosition.y)
            {
                m_parkMain.goParkRoot.transform.localPosition = new Vector3(m_parkMain.goParkRoot.transform.localPosition.x, fMaxY, m_parkMain.goParkRoot.transform.localPosition.z);
            }
            else
            {
            }


            if (InputManager.Instance.m_TouchInfo.Swipe == false)
            {
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.PINCH:
            if (bInit)
            {
                m_fPinchValueBase = InputManager.Instance.m_TouchInfo.PinchPos.magnitude;
                m_fPinchValue     = m_fPinchValueBase;
                //m_fPinchValue = InputManager.Instance.m_TouchInfo.PinchDelta;
                Debug.Log(InputManager.Instance.m_TouchInfo.PinchPos);
            }

            //Debug.Log (string.Format ("base={0} now={1} rate={2} ", InputManager.Instance.m_TouchInfo.PinchDelta, m_fPinchValue, (InputManager.Instance.m_TouchInfo.PinchDelta / m_fPinchValue)));
            Debug.Log(string.Format("base={0} now={1} delta={2} rate={3} ", m_fPinchValueBase, m_fPinchValue, InputManager.Instance.m_TouchInfo.PinchDelta, (m_fPinchValue / m_fPinchValueBase)));

            // ここの判定危険かも
            if (InputManager.Instance.IsPinch() == false && InputManager.Instance.m_TouchInfo.TouchUp)
            {
                m_eStep = STEP.IDLE;
            }
            else
            {
                m_fPinchValue  = InputManager.Instance.m_TouchInfo.PinchDelta;
                m_fPinchValue *= 0.001f;

                float fRate = GameMain.ParkRoot.myTransform.localScale.x;
                fRate += m_fPinchValue;

                if (fRate < 0.5f)
                {
                    fRate = 0.5f;
                }
                else if (2.0f < fRate)
                {
                    fRate = 2.0f;
                }
                GameMain.ParkRoot.myTransform.localScale = new Vector3(fRate, fRate, fRate);
            }
            break;

        case STEP.SHOP:
            if (bInit)
            {
                GameObject objShopDetail = PrefabManager.Instance.MakeObject("prefab/PrefShopDetail", gameObject);
                m_ctrlShopDetail = objShopDetail.GetComponent <CtrlShopDetail> ();
                m_ctrlShopDetail.Init(m_selectItem, m_parkMain.m_csParkRoot);
                //m_selectItem;
            }
            if (m_ctrlShopDetail.IsEnd())
            {
                Destroy(m_ctrlShopDetail.gameObject);
                m_ctrlShopDetail = null;
                m_eStep          = STEP.IDLE;
            }
            break;

        case STEP.SPEED_BUILD_CHECK:
            if (bInit)
            {
                //PrefItemCheck
                GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefItemCheck", gameObject);
                m_itemCheck = objOjisan.GetComponent <CtrlItemCheck> ();
                string strNokoriTime = makeNokoriTime(m_iNokoriTime);
                int    iNeedTicket   = RequireTicketNum(m_iNokoriTime);
                m_itemCheck.Initialize(m_selectItem.item_id, string.Format("この施設は完成まで\n{0}です\n\nチケット{1}枚で\nすぐに完成します。", strNokoriTime, iNeedTicket));

                if (DataManager.user.m_iTicket < iNeedTicket)
                {
                    m_itemCheck.YesOrNo.EnableButtonYes(false);
                }
            }
            if (m_itemCheck.IsYes())
            {
                m_eStep = STEP.SPEED_BUILD;
            }
            else if (m_itemCheck.IsNo())
            {
                Destroy(m_itemCheck.gameObject);
                m_eStep = STEP.IDLE;
            }
            else
            {
            }
            break;

        case STEP.SPEED_BUILD:
            Destroy(m_itemCheck.gameObject);

            CsvItemData csv_item_data = DataManager.GetItem(m_selectItem.item_id);

            Dictionary <string, string> dict = new Dictionary <string, string> ();
            //dict.Add ("create_time", "\"1900-01-01 00:00:00\"");
            //dict.Add ("setting_time", "\""+ TimeManager.StrGetTime() + "\"");
            dict.Add("create_time", "\"" + TimeManager.StrGetTime(-1 * csv_item_data.production_time) + "\"");

            GameMain.dbItem.Update(m_selectItem.item_serial, dict);
            DataManager.user.AddTicket(-1 * RequireTicketNum(m_iNokoriTime));

            // 仕事の確認
            DataWork.WorkCheck();
            GameMain.Instance.HeaderRefresh();
            m_eStep = STEP.IDLE;
            break;


        default:
            break;
        }
    }
Exemplo n.º 11
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.INIT:


            m_eStep = STEP.READY;
            if (m_dataItemMaster.category == (int)Define.Item.Category.NONE)
            {
                m_eStep = STEP.IDLE;
            }
            else
            {
                double diff = TimeManager.Instance.GetDiffNow(m_dataItem.create_time).TotalSeconds;
                //Debug.Log ( m_dataItem.item_id.ToString() + ":" + m_dataItem.item_serial.ToString() + ":" + diff.ToString ());

                // 絶対かこなので 
                diff *= -1;

                if (m_dataItemMaster.production_time < diff)
                {
                    m_eStep = STEP.IDLE;
                }
                else if (0 == m_dataItemMaster.production_time)
                {
                    m_eStep = STEP.IDLE;
                }
                else
                {
                }
            }
            break;

        case STEP.READY:
            if (bInit)
            {
                m_fCheckBuildTime     = 0.0f;
                m_fCheckBuildInterval = 0.5f;
                change_sprite(m_sprItem, GetReadyItemName(m_dataItemMaster.size));

                double diff = TimeManager.Instance.GetDiffNow(m_dataItem.create_time).TotalSeconds;
                diff         *= -1;
                m_iNokoriTime = m_dataItemMaster.production_time - (int)diff;

                GameObject obj = PrefabManager.Instance.MakeObject("Prefab/PrefFieldItemBuildTime", gameObject);
                obj.transform.localPosition = new Vector3(0.0f, 40.0f * m_dataItemMaster.size, 0.0f);
                m_csBuildTime = obj.GetComponent <CtrlFieldItemBuildTime> ();
                m_csBuildTime.Init(m_iNokoriTime, m_sprItem.depth, m_dataItemMaster.item_id);
                m_csBuildTime.TriggerClear();
            }
            m_fCheckBuildTime += Time.deltaTime;
            if (m_fCheckBuildInterval < m_fCheckBuildTime)
            {
                m_fCheckBuildTime -= m_fCheckBuildInterval;

                // データ撮り直し
                m_dataItem = GameMain.dbItem.Select(m_dataItem.item_serial);

                double diff = TimeManager.Instance.GetDiffNow(m_dataItem.create_time).TotalSeconds;
                diff         *= -1;
                m_iNokoriTime = m_dataItemMaster.production_time - (int)diff;

                if (0 < m_iNokoriTime)
                {
                    m_csBuildTime.SetNokoriSec(m_iNokoriTime);
                }
                else
                {
                    Destroy(m_csBuildTime.gameObject);
                    m_csBuildTime = null;
                    m_eStep       = STEP.IDLE;
                    DataWork.WorkCheck();
                }
            }
            if (m_csBuildTime)
            {
                if (m_csBuildTime.ButtonPushed)
                {
                    m_csBuildTime.TriggerClear();
                    GameMain.Instance.BuildingSerial = m_dataItem.item_serial;
                }
            }
            break;

        case STEP.IDLE:
            if (bInit)
            {
                change_sprite(m_sprItem, m_dataItem.item_id);
                m_fCheckBuildTime = 0.0f;
            }

            if (0 < m_iconRootList.Count)
            {
                m_fCheckBuildTime += Time.deltaTime;
                if (1.0f < m_fCheckBuildTime)
                {
                    m_fCheckBuildTime -= 1.0f;

                    int iIndex = 0;

                    List <UISprite> sprList = new List <UISprite> ();
                    foreach (CtrlIconRoot icon in m_iconRootList)
                    {
                        sprList.Add(icon.m_sprIcon);
                    }
                    sprList.Sort(CompareByID);

                    int iLoop = 2;
                    foreach (UISprite sprite in sprList)
                    {
                        sprite.depth = m_sprItem.depth + iLoop;
                        iLoop       += 1;
                    }
                }
            }
            break;

        case STEP.EDITTING:
            if (bInit)
            {
                change_sprite(m_sprItem, m_dataItem.item_id);
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
    }