Example #1
0
            public void RunEvent(MapInstance map)
            {
                SummonNpc(Map);
                map.Broadcast("msg 0 The battle begin in 5 seconds.");
                map.SendInMapAfter(1, "msg 0 The battle begin in 4 seconds.");
                map.SendInMapAfter(2, "msg 0 The battle begin in 3 seconds.");
                map.SendInMapAfter(3, "msg 0 The battle begin in 2 seconds.");
                map.SendInMapAfter(4, "msg 0 The battle begin in 1 seconds.");
                map.SendInMapAfter(5, "msg 0 Fight !");

                Observable.Timer(TimeSpan.FromSeconds(5)).Subscribe(o =>
                {
                    CreateGroup(Map.Sessions);
                    GenerateBattleRainbowPacket(RainbowTeamBattleType.Blue);
                    GenerateBattleRainbowPacket(RainbowTeamBattleType.Red);
                    map.IsPVP = true;

                    // Observable Disposed → EndEvent()
                    RainbowBattleManager.ObservableFlag = Observable.Interval(TimeSpan.FromSeconds(7)).Subscribe(s =>
                    {
                        RainbowBattleManager.GenerateScoreForAll();
                    });
                });

                Observable.Timer(TimeSpan.FromSeconds(605)).Subscribe(o =>
                {
                    RainbowBattleManager.EndEvent(map);
                });
            }