예제 #1
0
    public override void OnUpdate()
    {
        if (TimeManager.Instance != null)
        {
            if (TimeManager.Instance.RealTimeSinceLogIn - lastCheckTimer > 5000)
            {
                if (deviceConnectedInternetStatus == 0) // 没赋值过 取网络类型
                {
                    deviceConnectedInternetStatus = LywConfig.GetDeviceConnectedInternetStatus();
                }
                lastCheckTimer = TimeManager.Instance.RealTimeSinceLogIn;

                bool netChanged = false; // 标记网络类型是否有改变
                if (deviceConnectedInternetStatus != LywConfig.GetDeviceConnectedInternetStatus())
                {
                    netChanged = true;
                    deviceConnectedInternetStatus = LywConfig.GetDeviceConnectedInternetStatus();
                }

                if (netChanged)
                {
                    CheckWhetherNetworkBroken();
                }
            }
        }
    }
예제 #2
0
 public override bool Execute(ServerBusiness bsn)
 {
     if (LywConfig.GetPublisher() == ProductPublisher.Local)
     {
         // 本地登陆
         return(bsn.LoginAS(asHost, asPort, CallBackId, accountName, password, randomSeed, channelId, version, deviceInfo));
     }
     else
     {
         // 平台登陆
         return(bsn.LoginAS(asHost, asPort, CallBackId, accountName, password, randomSeed, channelId, version, deviceInfo, userId, channelUserId, channelCode, productCode, token));
     }
 }
예제 #3
0
    /// <summary>
    /// 创建发布者平台实例, 并调用发布者平台的初始化方法
    /// </summary>
    /// <param name="gameObject"></param>
    public static void CreateOnGameObject(GameObject gameObject, IPlatformListener platformListener)
    {
        switch (LywConfig.GetPublisher())
        {
        case ProductPublisher.Local: instance = gameObject.AddComponent <Platform>(); break;

        case ProductPublisher.LywGames: instance = gameObject.AddComponent <LywPlatform>(); break;

        default: LoggerManager.Instance.Error("Invalid publisher type when create platform.Invalid Platform type is " + LywConfig.GetPublisher()); break;
        }

        // 创建平台即初始化平台
        if (instance != null)
        {
            instance.platformListener = platformListener;
            instance.Initialize();
        }
    }
예제 #4
0
 /// <summary>
 /// 退出游戏
 /// </summary>
 public virtual void Exit(string title, string text, string ok, string cancel)
 {
     LywConfig.Exit(title, text, ok, cancel);
 }