Ejemplo n.º 1
0
    // 古堡争霸
    private void CityBattlePush()
    {
        for (var i = 0; i < 7; i++)
        {
            var key = string.Format("CityBattle{0}", i);
            PlatformHelper.DeleteLocalNotificationWithKey(key);
        }

        if (!CheckCondition(1))
        {
            return;
        }
        var now        = Game.Instance.ServerTime;
        var targetTime = new DateTime(now.Year, now.Month, now.Day, 21, 0, 0);

        for (var i = 0; i < 7; i++)
        {
            var key    = string.Format("CityBattle{0}", i);
            var target = targetTime.AddDays(i);
            if (target < now)
            {
                continue;
            }
            var diff = target - now;
            PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240149), diff.TotalSeconds);
        }
    }
Ejemplo n.º 2
0
    private void WishingPoolPush()
    {
        const string key = "WishingPool";

        PlatformHelper.DeleteLocalNotificationWithKey(key);

        if (!CheckCondition(8))
        {
            return;
        }

        var controller = UIManager.Instance.GetController(UIConfig.WishingUI);
        var ret        = controller.CallFromOtherClass("GetNextFreeTime", null);

        if (ret != null)
        {
            var dateData   = (long)ret;
            var now        = Game.Instance.ServerTime;
            var targetTime = Extension.FromServerBinary(dateData);

            if (targetTime > now)
            {
                PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240156),
                                                    (targetTime - now).TotalSeconds);
            }
        }
    }
Ejemplo n.º 3
0
    private void GoldenArmyPush()
    {
        for (var i = 0; i < 7; i++)
        {
            var key1 = string.Format("GoldenArmyAM{0}", i);
            var key2 = string.Format("GoldenArmyPM{0}", i);
            PlatformHelper.DeleteLocalNotificationWithKey(key1);
            PlatformHelper.DeleteLocalNotificationWithKey(key2);
        }

        if (!CheckCondition(4))
        {
            return;
        }

        var now         = Game.Instance.ServerTime;
        var targetTime1 = new DateTime(now.Year, now.Month, now.Day, 11, 55, 0);
        var targetTime2 = new DateTime(now.Year, now.Month, now.Day, 19, 55, 0);

        for (var i = 0; i < 7; i++)
        {
            var key1  = string.Format("GoldenArmyAM{0}", i);
            var key2  = string.Format("GoldenArmyPM{0}", i);
            var diff1 = targetTime1 - now;
            var diff2 = targetTime2 - now;
            targetTime1 = targetTime1.AddDays(1);
            targetTime2 = targetTime2.AddDays(1);

            PlatformHelper.SetLocalNotification(key1, GameUtils.GetDictionaryText(240152), diff1.TotalSeconds);
            PlatformHelper.SetLocalNotification(key2, GameUtils.GetDictionaryText(240152), diff2.TotalSeconds);
        }
    }
Ejemplo n.º 4
0
    private void ElfDrawPush()
    {
        const string key = "ElfDraw";

        PlatformHelper.DeleteLocalNotificationWithKey(key);

        if (!CheckCondition(7))
        {
            return;
        }
        var controller = UIManager.Instance.GetController(UIConfig.ElfUI);
        var ret        = controller.CallFromOtherClass("GetIsFreeDraw", null);

        if ((int?)ret == 0)
        {
            var targetTime = Game.Instance.ServerTime.AddDays(1).Date;
            PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240155),
                                                (targetTime - Game.Instance.ServerTime).TotalSeconds);
        }
    }
Ejemplo n.º 5
0
    private void BrainStromPush()
    {
        for (var i = 0; i < 7; i++)
        {
            var key = string.Format("BrainStrom{0}", i);
            PlatformHelper.DeleteLocalNotificationWithKey(key);
        }

        if (!CheckCondition(6))
        {
            return;
        }
        var controller = UIManager.Instance.GetController(UIConfig.AnswerUI);
        var ret        = controller.CallFromOtherClass("IsMaxAnser", null);

        var now = Game.Instance.ServerTime;

        for (var i = 0; i < 7; i++)
        {
            var key        = string.Format("BrainStrom{0}", i);
            var targetTime = new DateTime(now.Year, now.Month, now.Day, 21, 30, 0);
            if (i == 0)
            {
                if (!(bool)ret)
                {
                    PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240154),
                                                        (targetTime - Game.Instance.ServerTime).TotalSeconds);
                }
            }
            else
            {
                PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240154),
                                                    (targetTime - Game.Instance.ServerTime).TotalSeconds);
            }

            now = now.AddDays(1);
        }
    }
Ejemplo n.º 6
0
    private void MapLordPush()
    {
        for (var i = 0; i < 3; i++)
        {
            for (var j = 0; j < 5; j++)
            {
                var key = string.Format("MapLordD{0}H{1}", i, j);
                PlatformHelper.DeleteLocalNotificationWithKey(key);
            }
        }

        if (!CheckCondition(5))
        {
            return;
        }

        var now = Game.Instance.ServerTime;

        for (var i = 0; i < 3; i++)
        {
            var targetTime = new DateTime(now.Year, now.Month, now.Day, 8, 55, 0);
            for (var j = 0; j < 5; j++)
            {
                var key = string.Format("MapLordD{0}H{1}", i, j);
                PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240153),
                                                    (targetTime - Game.Instance.ServerTime).TotalSeconds);
                if (j == 0)
                {
                    targetTime = targetTime.AddHours(4);
                }
                else
                {
                    targetTime = targetTime.AddHours(3);
                }
            }
            now = now.AddDays(1);
        }
    }
Ejemplo n.º 7
0
    private void CurseCastlePush()
    {
        for (var i = 0; i < 2; i++)
        {
            for (var j = 0; j < 10; j++)
            {
                var key = string.Format("CurseCastleD{0}H{1}", i, j);
                PlatformHelper.DeleteLocalNotificationWithKey(key);
            }
        }

        if (!CheckCondition(3))
        {
            return;
        }

        var controller = UIManager.Instance.GetController(UIConfig.ActivityUI);
        var IsMaxCount = controller.CallFromOtherClass("IsBloodCastleMaxCount", null);
        var now        = Game.Instance.ServerTime;
        var targetTime = new DateTime(now.Year, now.Month, now.Day, 10, 35, 0);

        for (var i = 0; i < 2; i++)
        {
            for (var j = 0; j < 10; j++)
            {
                var key  = string.Format("CurseCastleD{0}H{1}", i, j);
                var diff = targetTime - now;
                targetTime = targetTime.AddHours(1);
                if (i == 0 && (bool)IsMaxCount)
                {
                    continue;
                }
                PlatformHelper.SetLocalNotification(key, GameUtils.GetDictionaryText(240151), diff.TotalSeconds);
            }
            targetTime = new DateTime(now.Year, now.Month, now.AddDays(1).Day, 10, 35, 0);
        }
    }
Ejemplo n.º 8
0
    private IEnumerator EnterGameCoroutine(ulong characterId, List <int> ret)
    {
        using (new BlockingLayerHelper(0))
        {
            var playerData = PlayerDataManager.Instance;
            playerData.Guid = characterId;
            var msg = Instance.EnterGame(characterId);
            yield return(msg.SendAndWaitUntilDone());

            Logger.Debug(msg.State.ToString());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    Logger.Debug("EnterGame.Reply");
                    playerData.CreateSysnc(characterId);
                    playerData.ResetLoginApplyState();
                    playerData.ApplyBags();
                    playerData.ApplySkills();
                    playerData.ApplyMissions(-1);
                    playerData.ApplyFlagData();
                    playerData.ApplyExtData();
                    playerData.ApplyExtData64();
                    playerData.ApplyMails();
                    playerData.ApplyBooks();
                    playerData.ApplyQueueData();
                    // playerData.ApplytReviewState();
                    playerData.ServerId           = msg.Response.ServerId;
                    playerData.CharacterGuid      = characterId;
                    playerData.CharacterFoundTime = Extension.FromServerBinary(msg.Response.FoundTime);

                    var _friend = UIManager.Instance.GetController(UIConfig.FriendUI);
                    if (_friend != null)
                    {
                        _friend.CallFromOtherClass("ApplyAllInfo", new object[] {});
                    }

                    var chat = UIManager.Instance.GetController(UIConfig.ChatMainFrame);
                    if (chat != null)
                    {
                        chat.CallFromOtherClass("EnterGame", new object[] {});
                    }

                    var url = @"http://ip.ws.126.net/ipquery";
                    GameUtils.InvokeWebServer(url, AnalyzeIpAddress);
                    playerData.ApplyCityData();
                    playerData.ApplyTrading();
                    playerData.ApplyTeam();
                    playerData.InitTrigger();
                    playerData.ApplyActivityState();
                    playerData.ApplyAcitvityCompensate();
                    playerData.ApplyOperationActivity();
                    playerData.ApplyAnchorRoomInfo();
                    playerData.ApplyAnchorIsInRoom();
                    playerData.ApplyMount();
                    EventDispatcher.Instance.DispatchEvent(new Event_ApplyUnionWarInfo());
                    //bug统计id
                    PlatformHelper.BuglySetUserId(characterId.ToString());

                    //umeng登录
                    PlatformHelper.ProfileSignIn(characterId.ToString());
                    Game.Instance.LoginTime = Game.Instance.ServerTime;
                    playerData.tmpTime      = Game.Instance.ServerTime;

                    GameLogic.IsFristLogin = true;

                    PlayerDataManager.Instance.ReviewState = GameSetting.Instance.ReviewState;

                    // 增加长时间不上线推送
                    PlatformHelper.ClearAllLocalNotification();
                    int[] days = { 1, 2, 6 };
                    for (var i = 0; i < 3; i++)
                    {
                        var key = string.Format("OffLineDays{0}", days[i]);
                        PlatformHelper.DeleteLocalNotificationWithKey(key);
                        var _now         = Game.Instance.ServerTime;
                        var _targetTime1 = new DateTime(_now.Year, _now.Month, _now.Day, 18, 40, 0);
                        var targetTime   = _targetTime1.AddDays(days[i]);
                        var time         = (targetTime - Game.Instance.ServerTime).TotalSeconds;
                        var message      = GameUtils.GetDictionaryText(240161 + i);
                        PlatformHelper.SetLocalNotification(key, message, time);
                    }
                    //superVip 预加载
                    playerData.ApplySuperVipData(false);

                    //预加载ui资源
                    ResourceManager.Instance.LoadResourceIntoCacheAsync();
                    EventDispatcher.Instance.DispatchEvent(new UIEvent_VisibleEyeCanBeStart(true));
                }
                else
                {
                    PlayCG.Instance.Destroy();
                    //UIManager.Instance.ShowNetError(msg.ErrorCode);
                    Logger.Debug("EnterGame..................." + msg.ErrorCode);
                }
            }
            else
            {
                PlayCG.Instance.Destroy();
                //GameUtils.ShowLoginTimeOutTip();
            }

            if (ret != null)
            {
                ret.Clear();
                ret.Add((int)msg.State);
                ret.Add(msg.ErrorCode);
            }
        }
    }