コード例 #1
0
    private void OnWebRequestSuccess(object sender, GameFramework.Event.GameEventArgs e)
    {
        WebRequestSuccessEventArgs evt = (WebRequestSuccessEventArgs)e;

        Log.Info("Web Request Success! ");
        m_LatestVersionInfo = Utility.Json.ToObject <VersionInfo>(evt.GetWebResponseBytes());

        //先检测游戏版本号
        Version curVersion = new Version(Application.version);
        Version latVersion = new Version(m_LatestVersionInfo.LatestGameVersion);

        if (curVersion.CompareTo(latVersion) < 0)
        {
            Log.Info("游戏有新版本更新。");
            //TODO:如果有需要整包更新,则先进行整包更新
            return;
        }

        //再检测资源版本号
        if (GameManager.Resource.CheckVersionList(m_LatestVersionInfo.LatestInternalResourceVersion) == GameFramework.Resource.CheckVersionListResult.Updated)
        {
            Log.Info("资源是最新的,无需更新。");
            m_IsUpdateVersionListComplete = true;

            Log.Info("最新当前资源适用游戏版本: ApplicableGameVersion : {0}.", GameManager.Resource.ApplicableGameVersion);
            Log.Info("最新内部资源版本号: {0}.", GameManager.Resource.InternalResourceVersion);
            return;
        }

        Log.Info("进行版本资源列表更新...");
        GameManager.Resource.UpdatePrefixUri = Utility.Path.GetCombinePath(m_LatestVersionInfo.ResourceUpdateUrl, GetResourceVersion(), GetOSName());
        GameManager.Resource.UpdateVersionList(m_LatestVersionInfo.ResourceLength, m_LatestVersionInfo.ResourceHashCode, m_LatestVersionInfo.ResourceZipLength, m_LatestVersionInfo.ResourceZipHashCode);
    }
コード例 #2
0
    private void OnLoadConfigSuccess(object sender, GameFramework.Event.GameEventArgs e)
    {
        LoadConfigSuccessEventArgs evt = (LoadConfigSuccessEventArgs)e;
        string flagKey = string.Format("Config.{0}", evt.ConfigName);

        m_LoadResFlag[flagKey] = true;
    }
コード例 #3
0
    private void OnNetworkConnected(object sender, GameFramework.Event.GameEventArgs e)
    {
        UnityGameFramework.Runtime.NetworkConnectedEventArgs ne = (UnityGameFramework.Runtime.NetworkConnectedEventArgs)e;
        if (ne.NetworkChannel != m_NetworkChannel)
        {
            return;
        }

        Log.Info("NetworkChannel {0} is connected. IP: {1}", ne.NetworkChannel.Name, ne.NetworkChannel.RemoteIPAddress.ToString());
    }
コード例 #4
0
    private void OnNetworkError(object sender, GameFramework.Event.GameEventArgs e)
    {
        UnityGameFramework.Runtime.NetworkErrorEventArgs ne = (UnityGameFramework.Runtime.NetworkErrorEventArgs)e;
        if (ne.NetworkChannel != m_NetworkChannel)
        {
            return;
        }

        Log.Error("Network Packet {0} Error : {1}.", ne.Id, ne.ErrorMessage);
    }
コード例 #5
0
    private void OnNetworkClosed(object sender, GameFramework.Event.GameEventArgs e)
    {
        UnityGameFramework.Runtime.NetworkClosedEventArgs ne = (UnityGameFramework.Runtime.NetworkClosedEventArgs)e;
        if (ne.NetworkChannel != m_NetworkChannel)
        {
            return;
        }

        Log.Error("NetworkChannel {0} is closed.", ne.NetworkChannel.Name);
    }
コード例 #6
0
    private void OnNetworkMissHeartBeat(object sender, GameFramework.Event.GameEventArgs e)
    {
        UnityGameFramework.Runtime.NetworkMissHeartBeatEventArgs ne = (UnityGameFramework.Runtime.NetworkMissHeartBeatEventArgs)e;
        if (ne.NetworkChannel != m_NetworkChannel)
        {
            return;
        }

        if (ne.MissCount > 2)
        {
            ne.NetworkChannel.Close();
        }
    }
コード例 #7
0
    private void OnNetworkCustomError(object sender, GameFramework.Event.GameEventArgs e)
    {
        UnityGameFramework.Runtime.NetworkCustomErrorEventArgs ne = (UnityGameFramework.Runtime.NetworkCustomErrorEventArgs)e;
        if (ne.NetworkChannel != m_NetworkChannel)
        {
            return;
        }

        if (ne.CustomErrorData != null)
        {
            Log.Error("Network Packet {0} CustomError : {1}.", ne.Id, ne.CustomErrorData);
        }
    }
コード例 #8
0
    private void OnResourceCheckComplete(object sender, GameFramework.Event.GameEventArgs e)
    {
        ResourceCheckCompleteEventArgs evt = (ResourceCheckCompleteEventArgs)e;
        int updateCount = evt.UpdateCount;

        if (updateCount <= 0)
        {
            Log.Info("无需更新资源。");
            m_IsUpdateAllComplete = true;
            return;
        }

        Log.Info("需要更新的资源有{0}个。", updateCount);
        //更新资源
        GameManager.Resource.UpdateResources();
    }
コード例 #9
0
 static int FireNow(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityGameFramework.Runtime.EventComponent obj = (UnityGameFramework.Runtime.EventComponent)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.EventComponent));
         object arg0 = ToLua.ToVarObject(L, 2);
         GameFramework.Event.GameEventArgs arg1 = (GameFramework.Event.GameEventArgs)ToLua.CheckObject(L, 3, typeof(GameFramework.Event.GameEventArgs));
         obj.FireNow(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #10
0
 private void OnOpenLaunchFormSuccess(object sender, GameFramework.Event.GameEventArgs e)
 {
     InitAll();
 }
コード例 #11
0
 private void OnResourceUpdateAllComplete(object sender, GameFramework.Event.GameEventArgs e)
 {
     Log.Info("所有资源更新完毕!");
     m_IsUpdateAllComplete = true;
 }
コード例 #12
0
    private void OnResourceUpdateSuccess(object sender, GameFramework.Event.GameEventArgs e)
    {
        ResourceUpdateSuccessEventArgs evt = (ResourceUpdateSuccessEventArgs)e;

        Log.Info("更新文件{0}完成!资源大小:{1}", evt.Name, evt.Length);
    }
コード例 #13
0
 private void OnResourceInitComplete(object sender, GameFramework.Event.GameEventArgs e)
 {
     OpenLaunchForm();
 }
コード例 #14
0
    private void OnWebRequestFailure(object sender, GameFramework.Event.GameEventArgs e)
    {
        WebRequestFailureEventArgs evt = (WebRequestFailureEventArgs)e;

        Log.Error("Web Request Failure !! Url:{0}", evt.WebRequestUri);
    }
コード例 #15
0
ファイル: EventManager.cs プロジェクト: yymqwl/KcpServer
 /// <summary>
 /// 抛出事件立即模式,这个操作不是线程安全的,事件会立刻分发。
 /// </summary>
 /// <param name="sender">事件源。</param>
 /// <param name="e">事件参数。</param>
 public void FireNow(object sender, GameEventArgs e)
 {
     m_EventPool.FireNow(sender, e);
 }
コード例 #16
0
ファイル: LaunchForm.cs プロジェクト: liwenchao4413/GF_Demo
    private void OnUpdateTips(object sender, GameFramework.Event.GameEventArgs e)
    {
        LaunchFormUpdateTipsEventArgs evt = (LaunchFormUpdateTipsEventArgs)e;

        m_Text.text = evt.Tips;
    }
コード例 #17
0
 private void LoadDataSetSuccessAction(object sender, GameFramework.Event.GameEventArgs e)
 {
     _isLoad = true;
 }
コード例 #18
0
 public void Fire(object sender, GameEventArgs e)
 {
     eventPool.Fire(sender, e);
 }
コード例 #19
0
 private void OnVersionListUpdateSuccess(object sender, GameFramework.Event.GameEventArgs e)
 {
     Log.Info("version.dat 更新完成!");
     m_IsUpdateVersionListComplete = true;
 }