Exemplo n.º 1
0
    public override void PageStart()
    {
        base.PageStart();
        m_bIsEnd = false;

        gameObject.SetActive(true);

        if (m_Book == null)
        {
            m_Book = new CsvBook();
            m_Book.Load(CsvBook.FILE_NAME);
        }

        GameObject goIconGrid = null;
        int        count      = 0;

        foreach (CsvBookParam param in m_Book.list)
        {
            if (count % 4 == 0)
            {
                goIconGrid = PrefabManager.Instance.MakeObject("prefab/GridBookIcon", m_goGrid.gameObject);
            }
            BookIcon bookIcon = PrefabManager.Instance.MakeObject("prefab/BookIcon", goIconGrid).GetComponent <BookIcon> ();
            bookIcon.Initialize(param, m_goGrid.gameObject.transform.parent.gameObject);
            count += 1;
        }
        m_goGrid.enabled = true;
        m_closeButton.TriggerClear();
    }
Exemplo n.º 2
0
    /*
     * void Start(){
     *      Initialize ("screenshot.png");
     * }
     */

    public void Initialize(string _strStillName, bool _bQuick = false)
    {
        Debug.Log(string.Format("still:[{0}]", _strStillName));

        CsvBook book = new CsvBook();

        book.Load(CsvBook.FILE_NAME);
        foreach (CsvBookParam param in book.list)
        {
            if (_strStillName.Contains(param.name))
            {
                param.status = 1;
                break;
            }
        }
        book.Save(CsvBook.FILE_NAME);
        m_eStepPre        = STEP.MAX;
        m_bQuick          = _bQuick;
        m_sprite.sprite2D = SpriteManager.Instance.Load(_strStillName);
        m_sprite.width    = (int)m_sprite.sprite2D.rect.width;
        m_sprite.height   = (int)m_sprite.sprite2D.rect.height;
        if (m_bQuick)
        {
            m_eStep = STEP.IDLE;
        }
        else
        {
            m_eStep = STEP.APPEAR;
            TweenAlphaAll(m_sprite.gameObject, 0.0f, 0.0f);
        }
        WindowStart();
        return;
    }
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.LogError (m_eStep);
        }
        switch (m_eStep)
        {
        case STEP.CHECK_CONFIG:
            if (bInit)
            {
                                #if UNITY_ANDROID
                NendAdInterstitial.Instance.Load("1f6b7ab7fb6f2e5ec95ee56c73e731e5b86cffee", "597666");
                                #elif UNITY_IPHONE
                NendAdInterstitial.Instance.Load("fb8bc1393982950ccbd6c706b35954725b3666bc", "597676");
                                #else
                                #endif
                m_iNetworkSerial = CommonNetwork.Instance.RecieveSpreadSheet(
                    DataManager.Instance.SPREAD_SHEET,
                    DataManager.Instance.SPREAD_SHEET_CONFIG_SHEET);
            }
            if (CommonNetwork.Instance.IsConnected(m_iNetworkSerial))
            {
                // 一度終了に向かうように設定
                m_eStep = STEP.GOTO_GAME;
                TNetworkData data = EveryStudioLibrary.CommonNetwork.Instance.GetData(m_iNetworkSerial);
                m_ssdSample = EveryStudioLibrary.CommonNetwork.Instance.ConvertSpreadSheetData(data.m_dictRecievedData);
                CsvConfig config_data = new CsvConfig();
                config_data.Input(m_ssdSample);
                if (false == config_data.Read(CsvConfig.KEY_CONFIG_VERSION).Equals(DataManager.Instance.config.Read(CsvConfig.KEY_CONFIG_VERSION)) || CONFIG_UPDATE == true)
                {
                    config_data.Save(CsvConfig.FILE_NAME);
                    DataManager.Instance.config.Load(CsvConfig.FILE_NAME);
                    m_eStep = STEP.CHECK_UPDATE;
                }

                if (Advertisement.isSupported)                   // If runtime platform is supported...
                {
                    string gameId = "";
                                        #if UNITY_ANDROID
                    gameId = config_data.Read("unity_ads_gameid_android");
                                        #elif UNITY_IOS
                    gameId = config_data.Read("unity_ads_gameid_ios");
                                        #endif
                    Advertisement.Initialize(gameId, true);                     // ...initialize.
                }
            }
            else if (CommonNetwork.Instance.IsError(m_iNetworkSerial))
            {
                m_eStep = STEP.NETWORK_ERROR;
            }
            else
            {
            }
            break;

        case STEP.CHECK_UPDATE:
            if (false == DataManager.Instance.config.Read(FileDownloadManager.KEY_DOWNLOAD_VERSION).Equals(DataManager.Instance.kvs_data.Read(FileDownloadManager.KEY_DOWNLOAD_VERSION)))
            {
                m_eStep = STEP.UPDATE_DOWNLOAD;
            }
            else if (false == DataManager.Instance.config.Read(DataManager.Instance.KEY_SCENARIO_VERSION).Equals(DataManager.Instance.kvs_data.Read(DataManager.Instance.KEY_SCENARIO_VERSION)))
            {
                m_eStep = STEP.UPDATE_SCENARIO;
            }
            else if (false == DataManager.Instance.config.Read(DataManager.Instance.KEY_CHAPTER_VERSION).Equals(DataManager.Instance.kvs_data.Read(DataManager.Instance.KEY_CHAPTER_VERSION)))
            {
                m_eStep = STEP.UPDATE_CHAPTER;
            }
            else if (false == DataManager.Instance.config.Read(DataManager.Instance.KEY_BOOK_VERSION).Equals(DataManager.Instance.kvs_data.Read(DataManager.Instance.KEY_BOOK_VERSION)))
            {
                m_eStep = STEP.UPDATE_BOOK;

/*			} else if (false == DataManager.Instance.config.Read (DataManager.Instance.KEY_IMAGE_LIST_VERSION).Equals (DataManager.Instance.kvs_data.Read (DataManager.Instance.KEY_IMAGE_LIST_VERSION))) {
 *                              m_eStep = STEP.CHECK_IMAGE_LIST;
 *                      } else if (false == DataManager.Instance.config.Read (DataManager.Instance.KEY_VOICE_LIST_VERSION).Equals (DataManager.Instance.kvs_data.Read (DataManager.Instance.KEY_VOICE_LIST_VERSION))) {
 *                              m_eStep = STEP.CHECK_VOICE_LIST;
 *                      } else if (false == DataManager.Instance.config.Read (DataManager.Instance.KEY_VOICESET_LIST_VERSION).Equals (DataManager.Instance.kvs_data.Read (DataManager.Instance.KEY_VOICESET_LIST_VERSION))) {
 *                              m_eStep = STEP.CHECK_VOICESET_LIST;
 */         }
            else
            {
                m_eStep = STEP.GOTO_GAME;
            }
            break;

        case STEP.UPDATE_SCENARIO:
            if (bInit)
            {
                m_iNetworkSerial = CommonNetwork.Instance.RecieveSpreadSheet(
                    DataManager.Instance.SPREAD_SHEET,
                    DataManager.Instance.config.Read("scenario"));
            }
            if (CommonNetwork.Instance.IsConnected(m_iNetworkSerial))
            {
                TNetworkData data = EveryStudioLibrary.CommonNetwork.Instance.GetData(m_iNetworkSerial);

                m_ssdSample  = EveryStudioLibrary.CommonNetwork.Instance.ConvertSpreadSheetData(data.m_dictRecievedData);
                m_scriptData = new CsvScript();
                Debug.Log(m_ssdSample);
                m_scriptData.Input(m_ssdSample);
                m_scriptData.Save(DataManager.Instance.FILENAME_SCENARIO);
                DataManager.Instance.kvs_data.WriteInt(DataManager.Instance.KEY_SCENARIO_VERSION, DataManager.Instance.config.ReadInt(DataManager.Instance.KEY_SCENARIO_VERSION));
                DataManager.Instance.kvs_data.Save(DataKvs.FILE_NAME);

                m_eStep = STEP.CHECK_UPDATE;
            }
            break;

        case STEP.UPDATE_DOWNLOAD:
            if (bInit)
            {
                m_iNetworkSerial = CommonNetwork.Instance.RecieveSpreadSheet(
                    DataManager.Instance.SPREAD_SHEET,
                    DataManager.Instance.config.Read("download"));
            }
            if (CommonNetwork.Instance.IsConnected(m_iNetworkSerial))
            {
                TNetworkData data = EveryStudioLibrary.CommonNetwork.Instance.GetData(m_iNetworkSerial);
                m_ssdSample = EveryStudioLibrary.CommonNetwork.Instance.ConvertSpreadSheetData(data.m_dictRecievedData);
                CsvDownload download_list = new CsvDownload();
                download_list.Input(m_ssdSample);
                download_list.Save(FileDownloadManager.FILENAME_DOWNLOAD_LIST);
                m_eStep = STEP.DATA_DOWNLOAD;
            }
            break;

        case STEP.DATA_DOWNLOAD:
            if (bInit)
            {
                CsvDownload download_list = new CsvDownload();
                download_list.Load(FileDownloadManager.FILENAME_DOWNLOAD_LIST);
                Debug.Log(TimeManager.StrGetTime());
                FileDownloadManager.Instance.Download(DataManager.Instance.config.ReadInt(FileDownloadManager.KEY_DOWNLOAD_VERSION), download_list.list);
            }
            if (FileDownloadManager.Instance.IsIdle())
            {
                m_eStep = STEP.CHECK_UPDATE;
                DataManager.Instance.kvs_data.WriteInt(FileDownloadManager.KEY_DOWNLOAD_VERSION, DataManager.Instance.config.ReadInt(FileDownloadManager.KEY_DOWNLOAD_VERSION));
                DataManager.Instance.kvs_data.Save(DataKvs.FILE_NAME);
            }
            break;

        case STEP.UPDATE_CHAPTER:
            if (bInit)
            {
                m_iNetworkSerial = CommonNetwork.Instance.RecieveSpreadSheet(
                    DataManager.Instance.SPREAD_SHEET,
                    DataManager.Instance.config.Read("chapter"));
            }
            if (CommonNetwork.Instance.IsConnected(m_iNetworkSerial))
            {
                TNetworkData data = EveryStudioLibrary.CommonNetwork.Instance.GetData(m_iNetworkSerial);
                m_ssdSample = EveryStudioLibrary.CommonNetwork.Instance.ConvertSpreadSheetData(data.m_dictRecievedData);
                CsvChapter chapter_data = new CsvChapter();
                chapter_data.Input(m_ssdSample);
                chapter_data.Save(CsvChapter.FILE_NAME);
                DataManager.Instance.kvs_data.WriteInt(DataManager.Instance.KEY_CHAPTER_VERSION, DataManager.Instance.config.ReadInt(DataManager.Instance.KEY_CHAPTER_VERSION));
                DataManager.Instance.kvs_data.Save(DataKvs.FILE_NAME);

                m_eStep = STEP.CHECK_UPDATE;
            }
            break;

        case STEP.UPDATE_BOOK:
            if (bInit)
            {
                m_iNetworkSerial = CommonNetwork.Instance.RecieveSpreadSheet(
                    DataManager.Instance.SPREAD_SHEET,
                    DataManager.Instance.config.Read("book"));
            }
            if (CommonNetwork.Instance.IsConnected(m_iNetworkSerial))
            {
                TNetworkData data = EveryStudioLibrary.CommonNetwork.Instance.GetData(m_iNetworkSerial);
                m_ssdSample = EveryStudioLibrary.CommonNetwork.Instance.ConvertSpreadSheetData(data.m_dictRecievedData);
                CsvBook book_data = new CsvBook();
                book_data.Input(m_ssdSample);
                book_data.Save(CsvBook.FILE_NAME);
                DataManager.Instance.kvs_data.WriteInt(DataManager.Instance.KEY_BOOK_VERSION, DataManager.Instance.config.ReadInt(DataManager.Instance.KEY_BOOK_VERSION));
                DataManager.Instance.kvs_data.Save(DataKvs.FILE_NAME);

                m_eStep = STEP.CHECK_UPDATE;
            }
            break;

        case STEP.GOTO_GAME:
            if (bInit)
            {
                SceneManager.LoadScene("title");
            }
            break;

        case STEP.NETWORK_ERROR:
            if (bInit)
            {
                m_btnNetworkError.gameObject.SetActive(true);
                m_btnNetworkError.TriggerClear();
            }
            if (m_btnNetworkError.ButtonPushed)
            {
                m_btnNetworkError.gameObject.SetActive(false);
                m_eStep = STEP.CHECK_CONFIG;
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
    }