Пример #1
0
    public string GetBundleUrl(string fileName)
    {
        string szUrl = "";

#if UNITY_EDITOR
        szUrl = Application.dataPath + "/../AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        //szUrl = m_szAssetUrl + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        //return Application.streamingAssetsPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
#elif UNITY_WEBGL
        string szPrefix = "";
        if (m_szAssetUrl.Length != 0)
        {
            szPrefix = m_szAssetUrl;
        }
        else
        {
            szPrefix = Application.streamingAssetsPath;
        }
        szUrl = szPrefix + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName + "?" + VersionManager.Instance().GetVersionUrl();
#else
        szUrl = Application.streamingAssetsPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        string szUpdatePath = Application.persistentDataPath + "/AssetBundles/" + SysUtil.GetPlatformName() + "/" + fileName;
        if (File.Exists(szUpdatePath))
        {
            szUrl = szUpdatePath;
        }
#endif
        SampleDebuger.LogGreen("bundle url : " + szUrl);
        return(szUrl);
    }
Пример #2
0
 public void Sync(GameProto.GameNotifyPlayerNextTetris oTetris)
 {
     if (m_oNextTetris == null)
     {
         m_oNextTetris = new Tetris();
     }
     m_oNextTetris.Init(oTetris.NextTetris);
     SampleDebuger.LogGreen(string.Format("next tetris [{0},{1}]", oTetris.NextTetris.DwTetrisShape, oTetris.NextTetris.DwTetrisDirect));
     m_bNeedRefresh = true;
 }
Пример #3
0
 public void OnGameNotifyPlayeGameEnd(byte[] pBuf)
 {
     GameProto.GameNotifyPlayeGameEnd oRet = GameProto.GameNotifyPlayeGameEnd.Parser.ParseFrom(pBuf);
     if (oRet == null)
     {
         SampleDebuger.LogYellow("OnGameNotifyPlayeGameEnd error parse");
         return;
     }
     SampleDebuger.LogGreen("game end!!!!!!!!!");
 }
Пример #4
0
 public void OnGameNotifyPlayerDead(byte[] pBuf)
 {
     GameProto.GameNotifyPlayerDead oRet = GameProto.GameNotifyPlayerDead.Parser.ParseFrom(pBuf);
     if (oRet == null)
     {
         SampleDebuger.LogYellow("GameNotifyPlayerDead error parse");
         return;
     }
     SampleDebuger.LogGreen("player : " + oRet.DwPlayerId.ToString() + " dead");
 }
Пример #5
0
    IEnumerator CheckVersionContent()
    {
        string szVersionMark = GameInstance.Instance().proServerUrl
                               + string.Format(GameInstance.Instance().proServerMarkPath, VersionManager.Instance().GetVersionUrl()) + "?" + Time.realtimeSinceStartup.ToString();
        WWW www = new WWW(szVersionMark);

        SampleDebuger.Log("+++++++++++ checkVersionContent +++++++++++ ");
        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            SampleDebuger.Log(szVersionMark);
            AssetBundleLoader.Instance().LoadAsset(GameObjectConstant.GetABUIPath(GameObjectConstant.g_szConfirmPanel), GameObjectConstant.g_szConfirmPanel, delegate(UnityEngine.Object ob)
            {
                GameObject go_RoleList = Instantiate((GameObject)ob, MainCanvas.Instance().transform);
                go_RoleList.GetComponent <ConfirmPanel>().Init("检测到大版本更新,请前往官网或者应用商店下载最新版本",
                                                               delegate(object ob1)
                {
                    //todo 下载
                    SampleDebuger.LogGreen("begin down load");
                }, null, delegate(object ob1)
                {
                    //todo 取消下载
                    SampleDebuger.LogGreen("cancel down load");
                }, null
                                                               );
            }
                                                   );
            yield break;
        }
        //下载更新包
        if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
        {
            m_comEnvChecker.StartDownload();
        }
        else
        {
            AssetBundleLoader.Instance().LoadAsset(GameObjectConstant.GetABUIPath(GameObjectConstant.g_szConfirmPanel), GameObjectConstant.g_szConfirmPanel, delegate(UnityEngine.Object ob)
            {
                GameObject go_RoleList = Instantiate((GameObject)ob, MainCanvas.Instance().transform);
                go_RoleList.GetComponent <ConfirmPanel>().Init("检测到游戏更新,请点击更新!",
                                                               delegate(object ob1)
                {
                    m_comEnvChecker.StartDownload();
                }, null, delegate(object ob1)
                {
                    //todo 取消下载
                    SampleDebuger.LogGreen("cancel down load");
                }, null
                                                               );
            }
                                                   );
        }
    }
Пример #6
0
    public virtual bool DownTetris()
    {
        if (!CheckDownTetris())
        {
            //向下移动一格
            m_oCurrentTetris.m_dwPosY += 1;
        }
        else
        {
            SampleDebuger.LogGreen(string.Format("down [{0},{1}]", m_oCurrentTetris.m_dwTetrisShape, m_oCurrentTetris.m_dwTetrisDirect));
            //固定住 那么就不能往下移动了 换下一个方块
            for (int i = 0; i < s_dwUnit; ++i)
            {
                for (int j = 0; j < s_dwUnit; ++j)
                {
                    uint dwBlockInfo = s_dwTetrisTable[m_oCurrentTetris.m_dwTetrisShape, m_oCurrentTetris.m_dwTetrisDirect, i, j];
                    if (dwBlockInfo == 0)
                    {
                        continue;
                    }
                    m_dwTetrisPool[m_oCurrentTetris.m_dwPosY - s_dwUnit + i, m_oCurrentTetris.m_dwPosX + j] = m_oCurrentTetris.m_dwTetrisColor;
                }
            }

            if (m_oCurrentTetris.m_dwPosY <= s_dwUnit)
            {
                OnEnd();
                return(true);
            }

            int dwRow = -1;
            while (CheckErase(ref dwRow))
            {
                EraseTetris(dwRow);
            }

            m_oCurrentTetris = m_oNextTetris;
            m_oNextTetris    = null;
        }
        m_bNeedRefresh = true;
        return(true);
    }
Пример #7
0
    public void OnRecv(byte[] pBuf, uint dwLen)
    {
        NetStream pStream     = new NetStream(pBuf, dwLen);
        string    szProtoName = "";

        pStream.ReadString(ref szProtoName);
        byte[] pProto = new byte[pStream.GetLeftLen()];
        pStream.ReadData(ref pProto, pStream.GetLeftLen());

        if (!m_mapCallBack.ContainsKey(szProtoName))
        {
            SampleDebuger.Log("can't find proto name " + szProtoName);
            return;
        }
        SampleDebuger.LogGreen(szProtoName);
        m_mapCallBack[szProtoName](pProto);

        //foreach (var item in m_pfOnRecv)
        //{
        //	item(pBuf, dwLen);
        //}
        //m_pfOnRecv(pBuf, dwLen);
    }
Пример #8
0
 public override void OnEnd()
 {
     SampleDebuger.LogGreen("player die");
 }