コード例 #1
0
    void SetWorkShopGridItemInfo(SteamPreFileAndVoteDetail del, UIWorkShopGridItem item)
    {
        if (item == null)
        {
            return;
        }
        item.gameObject.SetActive(true);

        if (del != null)
        {
            item.SetIsoName(del.m_rgchTitle);
            item.SetDownloaded(UIWorkShopCtrl.CheckDownloadExist(del.m_rgchTitle + VCConfig.s_IsoFileExt));
            if (del.m_aPreFileData != null)
            {
                VCIsoHeadData headData = new VCIsoHeadData();
                headData.SteamPreview = del.m_aPreFileData;
                item.SetAuthor(PELocalization.GetString(8000696));
                Texture2D texture = new Texture2D(4, 4);
                texture.LoadImage(headData.IconTex);
                item.SetIco(texture);
            }
            else
            {
                item.SetIco(null);
            }
        }
        else
        {
            item.SetIco(null);
            item.SetIsoName(PELocalization.GetString(8000695));
            item.SetAuthor(PELocalization.GetString(8000695));
        }

        item.ActiveLoadingItem(false);
    }
コード例 #2
0
    //private int mTitleIndex = -1;

    #region mono methods

    void Awake()
    {
        m_Instance = this;
        this.InitAllDownLoadedByLocal();
        m_CurColumnCount = this.GetCurColumnCountByScreenSize();
        this.BgAdaptiveCtrl.UpdateSizeByScreen(m_CurColumnCount, GridWidth);
        this.Page0AdaptiveCtrl.UpdateSizeByScreen(m_CurColumnCount, GridWidth);
    }
コード例 #3
0
 public static bool CheckDownloadExist(string fileName)
 {
     if (null == fileName || string.IsNullOrEmpty(fileName.Trim()) || null == m_Instance || null == m_Instance.m_LocalDownLoaded)
     {
         return(false);
     }
     fileName = UIWorkShopCtrl.GetValidFileName(fileName);
     return(m_Instance.m_LocalDownLoaded.Contains(fileName));
 }
コード例 #4
0
 void UpdateDownloadBtnState()
 {
     if (null != mSelectedDetail)
     {
         this.m_DownloadBtn.isEnabled = !UIWorkShopCtrl.CheckDownloadExist(mSelectedDetail.m_rgchTitle + VCConfig.s_IsoFileExt);
         return;
     }
     this.m_DownloadBtn.isEnabled = true;
 }
コード例 #5
0
 void WorkShopOnClose()
 {
     if (mWorkShopCtrl == null)
     {
         return;
     }
     GameObject.Destroy(mWorkShopCtrl.gameObject);
     mWorkShopCtrl = null;
 }
コード例 #6
0
    internal static void OnFilePublishEvent(object sender, EventArgs args)
    {
        SteamFileItem item = (SteamFileItem)sender;

        if (item != null)
        {
            UIWorkShopCtrl.PublishFinishCellBack(item.ID, item.PublishID, item.HashCode);
        }
    }
コード例 #7
0
    void OnDownLoadFileCallBack(byte[] fileData, PublishedFileId_t p_id, bool bOK, int index = -1, int dungeonId = -1)
    {
        if (isActve == false)
        {
            return;
        }

        //bool DonLoadSucess = false;
        if (bOK)
        {
            if (mItemsMap.ContainsKey(p_id))
            {
                if (mItemsMap[p_id] != null)
                {
                    SteamPreFileAndVoteDetail detail = mItemsMap[p_id];

                    VCIsoHeadData headData;

                    string creation = "Object";
                    if (VCIsoData.ExtractHeader(fileData, out headData) > 0)
                    {
                        creation = headData.Category.ToString();
                        creation = creation.Substring(2, creation.Length - 2);
                    }

                    string downLoadFilePath = VCConfig.s_IsoPath + string.Format("/Download/{0}/", creation);
                    string netCacheFilePath = VCConfig.s_CreationNetCachePath;

                    string downLoadFileName = detail.m_rgchTitle;
                    string netCacheFileName = CRC64.Compute(fileData).ToString();

                    if (SaveToFile(fileData, downLoadFileName, downLoadFilePath, VCConfig.s_IsoFileExt))
                    {
                        UIWorkShopCtrl.AddDownloadFileName(mItemsMap[p_id].m_rgchTitle + VCConfig.s_IsoFileExt, mIsPrivate);
                        mDownMap[p_id] = 100;
                    }

                    //lz-2016.05.30 保存一份到NetCache路径下,避免NetCache重复下载
                    SaveToFile(fileData, netCacheFileName, netCacheFilePath, VCConfig.s_CreationNetCacheFileExt);
                }
            }
        }
        else
        {
            mDownMap[p_id] = -1;
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000493));
        }

//		if (e_DownLoadFile != null)
//			e_DownLoadFile(filePath,DonLoadSucess);
    }
コード例 #8
0
    public void GetPrimaryFileResultEventHandler(byte[] fileData, PublishedFileId_t publishedFileId, bool bOK, int index, int dungeonId)
    {
        string fullpath = UIWorkShopCtrl.DownloadFileCallBack(fileData, publishedFileId, bOK);

        if (fullpath.Length > 0)
        {
            if (Pathea.PeGameMgr.IsSingle)
            {
                ExportRandIso(fullpath, dungeonId, index);
            }
            else
            {
                NetworkManager.SyncServer(EPacketType.PT_Common_ExportRandIso, dungeonId, index, fullpath);
            }
        }
    }
コード例 #9
0
    public static void AddDownloadFileName(string fileName, bool byUploadPage) //true ByUploadPage , false ByWorkShopPage
    {
        if (null == m_Instance && null == m_Instance.m_LocalDownLoaded)
        {
            return;
        }
        if (byUploadPage)
        {
            m_Instance.mPageWorkShopCtrl.SetItemIsDownloadedByFileName(fileName);
        }
        else
        {
            m_Instance.mPageUploadCtrl.SetItemIsDownloadedByFileName(fileName);
        }

        fileName = UIWorkShopCtrl.GetValidFileName(fileName);
        m_Instance.m_LocalDownLoaded.Add(fileName);
    }
コード例 #10
0
    void BtnMallOnClick()
    {
        if (mMallWnd == null)
        {
            GameObject mallWnd = GameObject.Instantiate(mallWndPrefab) as GameObject;
            mallWnd.transform.transform.parent = mUICenter.transform;
            mallWnd.transform.localPosition    = new Vector3(0, 40, -10);
            mallWnd.transform.localScale       = Vector3.one;
            mMallWnd           = mallWnd.GetComponent <UIMallWnd>();
            mMallWnd.e_OnHide += MallWndOnClose;
        }

        if (mRoomWnd.activeSelf)
        {
            mRoomWnd.SetActive(false);
            mLastWnd = mRoomWnd;
        }
        if (mUIServerWnd.activeSelf)
        {
            mUIServerWnd.SetActive(false);
            mLastWnd = mUIServerWnd;
        }
        if (mHostCreateWnd.activeSelf)
        {
            mHostCreateWnd.SetActive(false);
            mLastWnd = mHostCreateWnd;
        }
        //luwei
        if (mWorkShopCtrl != null)
        {
            GameObject.Destroy(mWorkShopCtrl.gameObject);
            mWorkShopCtrl = null;

            mLastWnd = mRoomWnd;
        }

        if (RoomGui_N.Instance.isShow)
        {
            RoomGui_N.Instance.gameObject.SetActive(false);
            mLastWnd = RoomGui_N.Instance.gameObject;
        }

        mMallWnd.gameObject.SetActive(true);
    }
コード例 #11
0
    void BtnWorkShopsOnClick()
    {
        if (mWorkShopCtrl == null)
        {
            GameObject workShop = GameObject.Instantiate(mWorkShopPrfab) as GameObject;
            workShop.transform.transform.parent = mUICenter.transform;
            workShop.transform.localPosition    = new Vector3(0, 40, -20);
            workShop.transform.localScale       = Vector3.one;
            mWorkShopCtrl = workShop.GetComponent <UIWorkShopCtrl>();
            if (mWorkShopCtrl == null)
            {
                return;
            }
            workShop.SetActive(true);
            mWorkShopCtrl.e_BtnClose += WorkShopOnClose;
            if (mRoomWnd.activeSelf)
            {
                mRoomWnd.SetActive(false);
                mLastWnd = mRoomWnd;
            }
            if (mUIServerWnd.activeSelf)
            {
                mUIServerWnd.SetActive(false);
                mLastWnd = mUIServerWnd;
            }
            if (mHostCreateWnd.activeSelf)
            {
                mHostCreateWnd.SetActive(false);
                mLastWnd = mHostCreateWnd;
            }

            if (RoomGui_N.Instance.isShow)
            {
                RoomGui_N.Instance.gameObject.SetActive(false);
                mLastWnd = RoomGui_N.Instance.gameObject;
            }

            if (mMallWnd != null && mMallWnd.isShow)
            {
                mMallWnd.gameObject.SetActive(false);
                mLastWnd = mMallWnd.gameObject;
            }
        }
    }
コード例 #12
0
 void BtnWorkShopOnClick()
 {
     if (mWorkShopCtrl == null && GameConfig.IsMultiMode)
     {
         GameObject workShop = GameObject.Instantiate(mWorkShopPrefab) as GameObject;
         workShop.transform.transform.parent = mCenterAuthor.transform;
         workShop.transform.localPosition    = new Vector3(0, 40, 0);
         workShop.transform.localScale       = Vector3.one;
         mWorkShopCtrl = workShop.GetComponent <UIWorkShopCtrl>();
         if (mWorkShopCtrl == null)
         {
             return;
         }
         mWorkShopCtrl.e_BtnClose += WorkShopOnClose;
         workShop.SetActive(true);
     }
     else
     {
         mWorkShopCtrl.gameObject.SetActive(true);
     }
 }
コード例 #13
0
    public void InitGrid()
    {
        mGrid.maxPerLine = IsLocalPage ? UIWorkShopCtrl.GetCurColumnCount() + 1 : UIWorkShopCtrl.GetCurColumnCount();
        for (int i = 0; i < mMaxGridCount; i++)
        {
            GameObject o = GameObject.Instantiate(mGridItem) as GameObject;
            o.transform.parent        = mGrid.gameObject.transform;
            o.transform.localRotation = Quaternion.identity;
            o.transform.localScale    = Vector3.one;
            o.transform.localPosition = new Vector3(0, 0, 0);

            UIWorkShopGridItem item = o.GetComponent <UIWorkShopGridItem>();
            item.index              = i;
            item.mClickItem        += OnClickItem;
            item.mDoubleClickItem  += OnDoubleClickItem;
            item.mBtnReloadOnClick += OnBtnReloadOnClick;
            item.mBtnDingOnClick   += OnClickWorkShopBtnDing;
            item.mBtnCaiOnClick    += OnClickWorkShopBtnCai;
            mUIItems.Add(item);
        }
    }
コード例 #14
0
    void WorkShopOnClose()
    {
        if (mWorkShopCtrl != null)
        {
#if MAINMENU_ISO
            GameObject.Destroy(mWorkShopCtrl.gameObject);
            mWorkShopCtrl = null;
            PeSceneCtrl.Instance.GotoMainMenuScene();
            return;
#endif
            if (mLastWnd != null && mLastWnd != mWorkShopCtrl.gameObject)
            {
                mLastWnd.SetActive(true);
            }
            else
            {
                mRoomWnd.SetActive(true);
            }
            GameObject.Destroy(mWorkShopCtrl.gameObject);
            mWorkShopCtrl = null;
        }
    }
コード例 #15
0
    private bool SaveToFile(byte[] fileData, string fileName, string filePath, string fileExt)
    {
        if (!Directory.Exists(filePath))
        {
            Directory.CreateDirectory(filePath);
        }

        fileName = UIWorkShopCtrl.GetValidFileName(fileName);

        string TempPath = filePath;

        filePath += fileName + fileExt;

        int i = 0;

        while (File.Exists(filePath))
        {
            i++;
            filePath = TempPath + fileName + i.ToString() + fileExt;
        }

        try
        {
            using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
            {
                BinaryWriter bw = new BinaryWriter(fileStream);
                bw.Write(fileData);
                bw.Close();
                fileStream.Close();
            }
            return(true);
        }
        catch (Exception e)
        {
            Debug.LogError(string.Format("Save ISO to filepath:{0} Error:{1}", filePath, e.ToString()));
            return(false);
        }
    }
コード例 #16
0
ファイル: GameUI.cs プロジェクト: shrubba/planetexplorers
    // add game ui
    void InstantiateGameUI()
    {
        // gameMain
        GameObject gameUI = AddUIPrefab(GameMainPrefab, gameObject.transform);

        mUIGameMenuCtrl = gameUI.GetComponentsInChildren <UIGameMenuCtrl>(true)[0];
        mUIGameMenuCtrl.Show();
        mUIMainMidCtrl = gameUI.GetComponentsInChildren <UIMainMidCtrl>(true)[0];
        mUIMainMidCtrl.Show();
        mUIMinMapCtrl = gameUI.GetComponentsInChildren <UIMinMapCtrl>(true)[0];
        mUIMinMapCtrl.Show();
        mNPCTalk = gameUI.GetComponentsInChildren <UINPCTalk>(true)[0];
        mNPCTalk.Hide();
        mNPCSpeech   = gameUI.GetComponentInChildren <UINpcSpeech>();
        mServantTalk = gameUI.GetComponentsInChildren <UIServantTalk>(true)[0];
        mServantTalk.Hide();
        gameUI.SetActive(true);

        //UI System
        gameUI                = AddUIPrefab(SytemPrefab, gameObject.transform);
        mSystemMenu           = gameUI.GetComponentInChildren <UISystemMenu>();
        mSystemMenu.e_OnShow += OnSystemWndShow;
        mSystemMenu.e_OnHide += OnSystemWndHide;
        mOption               = gameUI.GetComponentInChildren <UIOption>();
        mOption.e_OnShow     += OnSystemWndShow;
        mOption.e_OnHide     += OnSystemWndHide;
        mSaveLoad             = gameUI.GetComponentInChildren <UISaveLoad>();
        mSaveLoad.e_OnShow   += OnSystemWndShow;
        mSaveLoad.e_OnHide   += OnSystemWndHide;
        gameUI.SetActive(true);

        //Map
        gameUI      = AddUIPrefab(worldMapPrefab, gameObject.transform);
        mUIWorldMap = gameUI.GetComponent <UIWorldMapCtrl>();
        gameUI.SetActive(false);

        // UI Build
        gameUI      = AddUIPrefab(buildPrefab, gameObject.transform);
        mBuildBlock = gameUI.GetComponent <UIBuildBlock>();
        gameUI.SetActive(false);

        // Tip end
        gameUI    = AddUIPrefab(tipsWmdPrefab, gameObject.transform);
        mTipsCtrl = gameUI.GetComponent <UITips>();
        gameUI.SetActive(true);

        // TipRecords
        gameUI         = AddUIPrefab(tipRecordsMgrPrefab, gameObject.transform);
        mTipRecordsMgr = gameUI.GetComponent <UITipRecordsMgr>();
        gameUI.SetActive(false);

        //wnd
        // player info
        gameUI            = AddUIPrefab(playerInfoPrefab, tsCenter);
        mUIPlayerInfoCtrl = gameUI.GetComponent <UIPlayerInfoCtrl>();
        gameUI.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo;
        gameUI.SetActive(false);
        mUIPlayerInfoCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo;
        // Item Package
        gameUI           = AddUIPrefab(ItemPackagePrefab, tsCenter);
        mItemPackageCtrl = gameUI.GetComponent <UIItemPackageCtrl>();
        gameUI.SetActive(false);
        mItemPackageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_ItemPackge;
        // Npc Strage
        gameUI         = AddUIPrefab(npcStoragePrefab, tsCenter);
        mNpcStrageCtrl = gameUI.GetComponent <UINpcStorageCtrl>();
        gameUI.SetActive(false);
        mNpcStrageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_NpcStorage;
        // Compound Wnd
        gameUI           = AddUIPrefab(compoundWndPrefab, tsCenter);
        mCompoundWndCtrl = gameUI.GetComponent <UICompoundWndControl>();
        gameUI.SetActive(false);
        mCompoundWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Compound;
        // Servant Wnd
        gameUI          = AddUIPrefab(servantWndPrefab, tsCenter);
        mServantWndCtrl = gameUI.GetComponent <UIServantWnd>();
        gameUI.SetActive(false);
        mServantWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Servant;
        // Npc
        gameUI  = AddUIPrefab(npcGuiPrefab, tsCenter);
        mNpcWnd = gameUI.GetComponent <UINpcWnd>();
        gameUI.SetActive(false);
        mNpcWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Npc;
        // Mission Wnd
        gameUI            = AddUIPrefab(missionWndPrefab, tsCenter);
        mUIMissionWndCtrl = gameUI.GetComponent <UIMissionWndCtrl>();
        gameUI.SetActive(false);
        // MissionTrack Wnd
        gameUI           = AddUIPrefab(missionTrackWndPrefab, tsCenterOther);
        mMissionTrackWnd = gameUI.GetComponent <UIMissionTrackCtrl>();
        mMissionTrackWnd.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck;
        //		mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0);
        mMissionTrackWnd.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0);
        gameUI.SetActive(false);

        // Get Item Wnd
        gameUI   = AddUIPrefab(itemGetWndPrefab, tsCenter);
        mItemGet = gameUI.GetComponent <UIItemGet>();
        gameUI.SetActive(false);
        // Item Option Wnd
        gameUI  = AddUIPrefab(itemOpGuiPrefab, tsCenter);
        mItemOp = gameUI.GetComponent <UIItemOp>();
        gameUI.SetActive(false);
        // Shop Wnd
        gameUI   = AddUIPrefab(shopGuiPrefab, tsCenter);
        mShopWnd = gameUI.GetComponent <UIShopWnd>();
        gameUI.SetActive(false);
        mShopWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Shop;
        // Item Box
        gameUI   = AddUIPrefab(itemBoxGuiPrefab, tsCenter);
        mItemBox = gameUI.GetComponent <UIItemBox>();
        gameUI.SetActive(false);
        // Repair Wnd
        gameUI  = AddUIPrefab(repairWndGuiPrefab, tsCenter);
        mRepair = gameUI.GetComponent <UIRepairWnd>();
        gameUI.SetActive(false);
        mRepair.transform.localPosition = UIDefaultPostion.Instance.pos_Repair;
        // Power Plant Solar Wnd
        gameUI           = AddUIPrefab(powerPlantSolarPrefab, tsCenter);
        mPowerPlantSolar = gameUI.GetComponent <UIPowerPlantSolar>();
        gameUI.SetActive(false);
        mPowerPlantSolar.transform.localPosition = UIDefaultPostion.Instance.pos_PowerPlant;
        // Revive Gui Wnd
        gameUI  = AddUIPrefab(reviveGuiPrefab, tsCenter);
        mRevive = gameUI.GetComponent <UIRevive>();
        gameUI.SetActive(false);
        // Ware House Wnd
        gameUI     = AddUIPrefab(wareHouseGuiPrefab, tsCenter);
        mWarehouse = gameUI.GetComponent <UIWarehouse>();
        gameUI.SetActive(false);
        mWarehouse.transform.localPosition = UIDefaultPostion.Instance.pos_WareHouse;
        //colony Wnd
        gameUI            = AddUIPrefab(colonyWndPrefab, tsCenter);
        mCSUI_MainWndCtrl = gameUI.GetComponent <CSUI_MainWndCtrl>();
        gameUI.SetActive(false);
        //phone Wnd
        gameUI    = AddUIPrefab(phoneWndPrefab, tsCenter);
        mPhoneWnd = gameUI.GetComponent <UIPhoneWnd>();
        gameUI.SetActive(false);
        // skill wnd
        gameUI        = AddUIPrefab(skillWndPrefab, tsCenter);
        mSkillWndCtrl = gameUI.GetComponent <UISkillWndCtrl>();
        gameUI.SetActive(false);
        // workshop wnd
        gameUI        = AddUIPrefab(workshopPrefb, tsCenter);
        mWorkShopCtrl = gameUI.GetComponent <UIWorkShopCtrl>();
        gameUI.SetActive(false);
        //information wnd
        gameUI       = AddUIPrefab(informationPrefab, tsCenter);
        mTeamInfoMgr = gameUI.GetComponent <CSUI_TeamInfoMgr>();
        gameUI.SetActive(false);
        // railwayPoint
        gameUI        = AddUIPrefab(railwayPonitPrefab, tsCenter);
        mRailwayPoint = gameUI.GetComponent <RailwayPointGui_N>();
        gameUI.SetActive(false);

        // mallWndPrefab
        if (Pathea.PeGameMgr.IsMulti)
        {
            gameUI   = AddUIPrefab(mallWndPrefab, tsCenter);
            mMallWnd = gameUI.GetComponent <UIMallWnd>();
            gameUI.SetActive(false);
        }

        //UI Adminstrator
        //AdminUI
        gameUI           = AddUIPrefab(AdministratorPrefab, tsCenter);
        mAdminstratorWnd = gameUI.GetComponent <UIAdminstratorWnd>();
        gameUI.SetActive(false);

        // Driving UI
        gameUI       = AddUIPrefab(drivingPrefab, tsCenterOther);
        mDrivingCtrl = gameUI.GetComponent <UIDrivingCtrl>();
        gameUI.SetActive(false);

        // Custom stopwatch UI
        gameUI         = AddUIPrefab(stopwatchPrefab, transform);
        mStopwatchList = gameUI.GetComponent <UIStopwatchList>();
        gameUI.SetActive(false);

        // Custom npc talk UI
        gameUI     = AddUIPrefab(npcWndCustomPrefab, tsCenter);
        mNpcDialog = gameUI.GetComponent <UINpcDialog>();

        // Custom npc mission ui
        gameUI       = AddUIPrefab(missionWndCustomPrefab, tsCenter);
        mMissionGoal = gameUI.GetComponent <UIMissionGoal>();

        // Custom MissionTrack ui
        gameUI = AddUIPrefab(missionTrackCustomPrefab, tsCenterOther);
        mCustomMissionTrack = gameUI.GetComponent <UIMissionTrack>();
        mCustomMissionTrack.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck;
        //		mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0);
        mCustomMissionTrack.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0);

        //lz-2016.10.22 KickstarterCtrl
        gameUI           = AddUIPrefab(mKickstarterCtrlPrefab, tsCenter);
        mKickstarterCtrl = gameUI.GetComponent <KickstarterCtrl>();
        gameUI.SetActive(false);

        //lz-2016.11.07 NpcTalkHistoryWnd
        gameUI             = AddUIPrefab(mNpcTalkHistoryPrefab, tsCenter);
        mNpcTalkHistoryWnd = gameUI.GetComponent <NpcTalkHistoryWnd>();
        gameUI.SetActive(false);

        // itemsTrack Wnd
        gameUI         = AddUIPrefab(itemsTrackWndPrefab, tsCenterOther);
        mItemsTrackWnd = gameUI.GetComponent <UIItemsTrackCtrl>();
        mItemsTrackWnd.transform.localPosition = mMissionTrackWnd.transform.localPosition + new Vector3(0, 170f, 0);
        gameUI.SetActive(false);
    }