コード例 #1
0
        public string LockGisSb(List <string> GC_FNOFIDS, string GC_ID, string ltt_name)
        {
            string ss = "";

            try
            {
                foreach (string s in GC_FNOFIDS)
                {
                    ss += s + ",";
                }
                if (ss != "")
                {
                    ss = ss.Substring(0, ss.Length - 1);
                }
                CYZLog.writeLog("LockGisSb(" + ss + "," + GC_ID + ")");
                LockKgg(ref GC_FNOFIDS); //锁定依附与房之类的开关柜
                LockHb(ref GC_FNOFIDS);  //锁定依附与集抄得户表
                ss = TickHelper.LockSb(GC_FNOFIDS, ltt_name, GC_ID, tickerrh * 100000 + (tickerre++));
                // SxSj(ltt_name);
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End LockGisSb");
            return(ss);
        }
コード例 #2
0
        public List <string> DisableTicket3(List <string> FNOFIDS, string gc_id)
        {  //List<string> FNOFIDS
           //List<string> FNOFIDS = new List<string>();

            List <string> FildFNOFIDS = new List <string>();
            string        ss          = "";

            try
            {
                foreach (string s in FNOFIDS)
                {
                    ss += s + ",";
                }
                if (ss != "")
                {
                    ss = ss.Substring(0, ss.Length - 1);
                }
                CYZLog.writeLog("DisableTicket3(" + ss + ")");
                LockKgg(ref FNOFIDS);
                FildFNOFIDS = TickHelper.qxtick3(FNOFIDS, gc_id);
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End DisableTicket3()");
            return(FildFNOFIDS);
        }
コード例 #3
0
        public string DisableTicket2(List <string> FNOFIDS)
        {
            string ss = "";

            try
            {
                foreach (string s in FNOFIDS)
                {
                    ss += s + ",";
                }
                if (ss != "")
                {
                    ss = ss.Substring(0, ss.Length - 1);
                }
                CYZLog.writeLog("DisableTicket2(" + ss + ")");

                if (TickHelper.qxtick2(FNOFIDS))
                {
                    ss = "TRUE";
                }
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End DisableTicket2 (" + ss + ")");
            return(ss);
        }
コード例 #4
0
        public string OpenTicket(List <string> GC_FNOFIDS, string GC_UserName, string GC_ID)
        {
            string ss = "";

            try
            {
                foreach (string s in GC_FNOFIDS)
                {
                    ss += s + ",";
                }
                if (ss != "")
                {
                    ss = ss.Substring(0, ss.Length - 1);
                }
                CYZLog.writeLog("OpenTicket(" + ss + "," + GC_UserName + "," + GC_ID + ")");

                ss = TickHelper.openticks(GC_FNOFIDS, GC_UserName, GC_ID, tickerrh * 100000 + (tickerre++));
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End OpenTicket");
            return(ss);
        }
コード例 #5
0
        private static void GameThread()
        {
            long num = 0L;

            GameMgr.m_clearGamesTimer = TickHelper.GetTickCount();
            while (GameMgr.m_running)
            {
                long tickCount = TickHelper.GetTickCount();
                try
                {
                    GameMgr.UpdateGames(tickCount);
                    GameMgr.ClearStoppedGames(tickCount);
                }
                catch (Exception exception)
                {
                    GameMgr.log.Error("Room Mgr Thread Error:", exception);
                }
                long tickCount2 = TickHelper.GetTickCount();
                num += GameMgr.THREAD_INTERVAL - (tickCount2 - tickCount);
                if (num > 0L)
                {
                    Thread.Sleep((int)num);
                    num = 0L;
                }
                else
                {
                    if (num < -1000L)
                    {
                        GameMgr.log.WarnFormat("Room Mgr is delay {0} ms!", num);
                        num += 1000L;
                    }
                }
            }
        }
コード例 #6
0
        private static void GameThread()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            long balance = 0L;

            GameMgr.m_clearGamesTimer = TickHelper.GetTickCount();
            while (GameMgr.m_running)
            {
                long start     = TickHelper.GetTickCount();
                int  gameCount = 0;
                try
                {
                    gameCount = GameMgr.UpdateGames(start);
                    if (GameMgr.m_clearGamesTimer <= start)
                    {
                        GameMgr.m_clearGamesTimer += (long)GameMgr.CLEAR_GAME_INTERVAL;
                        ArrayList temp = new ArrayList();
                        foreach (BaseGame g in GameMgr.m_games)
                        {
                            if (g.GameState == eGameState.Stopped)
                            {
                                temp.Add(g);
                            }
                        }
                        foreach (BaseGame g in temp)
                        {
                            GameMgr.m_games.Remove(g);
                        }
                        ThreadPool.QueueUserWorkItem(new WaitCallback(GameMgr.ClearStoppedGames), temp);
                    }
                }
                catch (Exception ex)
                {
                    GameMgr.log.Error("Game Mgr Thread Error:", ex);
                }
                long end = TickHelper.GetTickCount();
                balance += GameMgr.THREAD_INTERVAL - (end - start);
                if (end - start > GameMgr.THREAD_INTERVAL * 2L)
                {
                    GameMgr.log.WarnFormat("Game Mgr spent too much times: {0} ms, count:{1}", end - start, gameCount);
                }
                if (balance > 0L)
                {
                    Thread.Sleep((int)balance);
                    balance = 0L;
                }
                else
                {
                    if (balance < -1000L)
                    {
                        balance += 1000L;
                    }
                }
                if (GameMgr.DELAY_TIME > 0)
                {
                    GameMgr.log.ErrorFormat("Delay for {0} ms!", GameMgr.DELAY_TIME);
                    Thread.Sleep(GameMgr.DELAY_TIME);
                }
            }
        }
コード例 #7
0
        public string PublishAppend(string GC_ID)
        {
            string ss = "TRUE";

            try
            {
                CYZLog.writeLog("PublishAppend(" + GC_ID + ")");
                var    userName   = string.Empty;
                var    oldVersion = string.Empty;
                string gistick    = string.Empty;
                string smzq       = Smzq(GC_ID, ref gistick);
                if (smzq == "")
                {
                    return("工单不存在。");
                }
                ss = TickHelper.posttick(GC_ID);
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End PublishAppend");
            return(ss);
        }
コード例 #8
0
        private void RenderProc(object obj)
        {
            var tickHelper = new TickHelper(Config.AnimateCycleTime / Config.AnimateFramePerCycle);

            this.outerEvent.Set();

            while (this.renderFlag)
            {
                this.innerEvent.WaitOne();

                this.UpdateBackGround(this.lastContextContainer.GameField);

                for (int i = 0; i < Config.AnimateFramePerCycle; i++)
                {
                    tickHelper.Set();
                    this.UpdateAnimate(i, this.lastContextContainer.GameField, this.lastContextContainer.PlayerCtx);
                    this.mainControl.Update(this.animateImage);
                    foreach (var playerControl in this.playerControlList)
                    {
                        playerControl.UpdateStateImage();
                    }
                    tickHelper.Wait();
                }

                for (int i = 0; i < this.lastContextContainer.PlayerCtx.Count(); i++)
                {
                    this.playerControlList[this.lastContextContainer.PlayerCtx[i].Number].UpdateScore(this.lastContextContainer.PlayerCtx[i].Name, this.lastContextContainer.PlayerCtx[i].Score.ToString(), this.lastContextContainer.PlayerCtx[i].Power.ToString(), this.lastContextContainer.PlayerCtx[i].Stun.ToString());
                }

                this.outerEvent.Set();
            }
        }
コード例 #9
0
ファイル: GameMgr.cs プロジェクト: changthai2540/DDTank-II
        private static void GameThread()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            long num = 0L;

            GameMgr.m_clearGamesTimer = TickHelper.GetTickCount();
            while (GameMgr.m_running)
            {
                long tickCount = TickHelper.GetTickCount();
                int  num2      = 0;
                try
                {
                    num2 = GameMgr.UpdateGames(tickCount);
                    if (GameMgr.m_clearGamesTimer <= tickCount)
                    {
                        GameMgr.m_clearGamesTimer += (long)GameMgr.CLEAR_GAME_INTERVAL;
                        ArrayList arrayList = new ArrayList();
                        foreach (BaseGame current in GameMgr.m_games)
                        {
                            if (current.GameState == eGameState.Stopped)
                            {
                                arrayList.Add(current);
                            }
                        }
                        foreach (BaseGame item in arrayList)
                        {
                            GameMgr.m_games.Remove(item);
                        }
                        ThreadPool.QueueUserWorkItem(new WaitCallback(GameMgr.ClearStoppedGames), arrayList);
                    }
                }
                catch (Exception exception)
                {
                    GameMgr.log.Error("Game Mgr Thread Error:", exception);
                }
                long tickCount2 = TickHelper.GetTickCount();
                num += GameMgr.THREAD_INTERVAL - (tickCount2 - tickCount);
                if (tickCount2 - tickCount > GameMgr.THREAD_INTERVAL * 2L)
                {
                    GameMgr.log.WarnFormat("Game Mgr spent too much times: {0} ms, count:{1}", tickCount2 - tickCount, num2);
                }
                if (num > 0L)
                {
                    Thread.Sleep((int)num);
                    num = 0L;
                }
                else
                {
                    if (num < -1000L)
                    {
                        num += 1000L;
                    }
                }
            }
        }
コード例 #10
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
        private static int ExecuteActions()
        {
            IAction[]       actions = null;
            Queue <IAction> actionQueue;

            Monitor.Enter(actionQueue = RoomMgr.m_actionQueue);
            try
            {
                if (RoomMgr.m_actionQueue.Count > 0)
                {
                    actions = new IAction[RoomMgr.m_actionQueue.Count];
                    RoomMgr.m_actionQueue.CopyTo(actions, 0);
                    RoomMgr.m_actionQueue.Clear();
                }
            }
            finally
            {
                Monitor.Exit(actionQueue);
            }
            int result;

            if (actions != null)
            {
                IAction[] array = actions;
                for (int i = 0; i < array.Length; i++)
                {
                    IAction ac = array[i];
                    try
                    {
                        long begin = TickHelper.GetTickCount();
                        ac.Execute();
                        long end = TickHelper.GetTickCount();
                        if (end - begin > 40L)
                        {
                            RoomMgr.log.WarnFormat("RoomMgr action spent too much times:{0},{1}ms!", ac.GetType(), end - begin);
                        }
                    }
                    catch (Exception ex)
                    {
                        RoomMgr.log.Error("RoomMgr execute action error:", ex);
                    }
                }
                result = actions.Length;
            }
            else
            {
                result = 0;
            }
            return(result);
        }
コード例 #11
0
        private static void RoomThread()
        {
            long balance = 0;

            m_nextClearTick = TickHelper.GetTickCount();
            m_nextPickTick  = TickHelper.GetTickCount();
            while (m_running)
            {
                long start = TickHelper.GetTickCount();
                try
                {
                    ExecuteActions();

                    if (m_nextPickTick <= start)
                    {
                        m_nextPickTick += PICK_UP_INTERVAL;
                        PickUpRooms(start);
                    }

                    if (m_nextClearTick <= start)
                    {
                        m_nextClearTick += CLEAR_ROOM_INTERVAL;
                        ClearRooms(start);
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Room Mgr Thread Error:", ex);
                }

                //时间补偿
                long end = TickHelper.GetTickCount();

                balance += THREAD_INTERVAL - (end - start);

                if (balance > 0)
                {
                    Thread.Sleep((int)balance);
                    balance = 0;
                }
                else
                {
                    if (balance < -1000)
                    {
                        log.WarnFormat("Room Mgr is delay {0} ms!", balance);
                        balance += 1000;
                    }
                }
            }
        }
コード例 #12
0
        private static void PrintResult(IBenchmarkResult result)
        {
            Table table = new Table("Name", "Total Ticks", "Average", "Min", "Max");

            table.AddRow(
                result.Name,
                TickHelper.ToHumanReadableTime(result.TotalTicks),
                TickHelper.ToHumanReadableTime(Convert.ToInt64(result.AverageTicks)),
                TickHelper.ToHumanReadableTime(result.MinimumTicks),
                TickHelper.ToHumanReadableTime(result.MaximumTicks));

            foreach (IBenchmarkResult metric in result.Results)
            {
                table.AddRow(
                    metric.Name,
                    TickHelper.ToHumanReadableTime(metric.TotalTicks),
                    TickHelper.ToHumanReadableTime(Convert.ToInt64(metric.AverageTicks)),
                    TickHelper.ToHumanReadableTime(metric.MinimumTicks),
                    TickHelper.ToHumanReadableTime(metric.MaximumTicks));
            }

            table.Config = TableConfiguration.UnicodeAlt();

            Console.WriteLine(table.ToString());

            table = new Table("Name", "Total Ticks", "Average", "Min", "Max");

            table.AddRow(
                result.Name,
                result.TotalTicks,
                result.AverageTicks,
                result.MinimumTicks,
                result.MaximumTicks);

            foreach (IBenchmarkResult metric in result.Results)
            {
                table.AddRow(
                    metric.Name,
                    metric.TotalTicks,
                    metric.AverageTicks,
                    metric.MinimumTicks,
                    metric.MaximumTicks);
            }

            table.Config = TableConfiguration.UnicodeAlt();

            Console.WriteLine(table.ToString());
            Console.Read();
        }
コード例 #13
0
        private static void RoomThread()
        {
            long balance = 0L;

            ProxyRoomMgr.m_nextClearTick = TickHelper.GetTickCount();
            ProxyRoomMgr.m_nextPickTick  = TickHelper.GetTickCount();
            while (ProxyRoomMgr.m_running)
            {
                long start = TickHelper.GetTickCount();
                try
                {
                    ProxyRoomMgr.ExecuteActions();
                    if (ProxyRoomMgr.m_nextPickTick <= start)
                    {
                        ProxyRoomMgr.m_nextPickTick += (long)ProxyRoomMgr.PICK_UP_INTERVAL;
                        ProxyRoomMgr.PickUpRooms(start);
                    }
                    if (ProxyRoomMgr.m_nextClearTick <= start)
                    {
                        ProxyRoomMgr.m_nextClearTick += (long)ProxyRoomMgr.CLEAR_ROOM_INTERVAL;
                        ProxyRoomMgr.ClearRooms(start);
                    }
                }
                catch (Exception ex)
                {
                    ProxyRoomMgr.log.Error("Room Mgr Thread Error:", ex);
                }
                long end = TickHelper.GetTickCount();
                balance += (long)ProxyRoomMgr.THREAD_INTERVAL - (end - start);
                if (balance > 0L)
                {
                    Thread.Sleep((int)balance);
                    balance = 0L;
                }
                else
                {
                    if (balance < -1000L)
                    {
                        ProxyRoomMgr.log.WarnFormat("Room Mgr is delay {0} ms!", balance);
                        balance += 1000L;
                    }
                }
                if (ProxyRoomMgr.DELAY_TIME > 0)
                {
                    ProxyRoomMgr.log.ErrorFormat("Delay for {0} ms!", ProxyRoomMgr.DELAY_TIME);
                    Thread.Sleep(ProxyRoomMgr.DELAY_TIME);
                }
            }
        }
コード例 #14
0
    IEnumerator IE_FadeOurProcess(float duration)
    {
        var ticker = new TickHelper();

        ticker.Reset(duration);
        yield return(null);

        while (ticker.Tick())
        {
            _source.volume = ticker.GetRemainTimeInPercent();
            yield return(null);
        }
        // finish fadeOut duration, call stop
        Stop();
    }
コード例 #15
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
        private static void RoomThread()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            long balance = 0L;

            RoomMgr.m_clearTick = TickHelper.GetTickCount();
            while (RoomMgr.m_running)
            {
                long start = TickHelper.GetTickCount();
                int  count = 0;
                try
                {
                    count = RoomMgr.ExecuteActions();
                    if (RoomMgr.m_clearTick <= start)
                    {
                        RoomMgr.m_clearTick += (long)RoomMgr.CLEAR_ROOM_INTERVAL;
                        RoomMgr.ClearRooms(start);
                    }
                }
                catch (Exception ex)
                {
                    RoomMgr.log.Error("Room Mgr Thread Error:", ex);
                }
                long end = TickHelper.GetTickCount();
                balance += (long)RoomMgr.THREAD_INTERVAL - (end - start);
                if (end - start > (long)(RoomMgr.THREAD_INTERVAL * 2))
                {
                    RoomMgr.log.WarnFormat("Room Mgr is spent too much times: {0} ms,count:{1}", end - start, count);
                }
                if (balance > 0L)
                {
                    Thread.Sleep((int)balance);
                    balance = 0L;
                }
                else
                {
                    if (balance < -1000L)
                    {
                        balance += 1000L;
                    }
                }
                if (RoomMgr.DELAY_TIME > 0)
                {
                    RoomMgr.log.ErrorFormat("Delay for {0} ms!", RoomMgr.DELAY_TIME);
                    Thread.Sleep(RoomMgr.DELAY_TIME);
                }
            }
        }
コード例 #16
0
        private static void RoomThread()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            long balance = 0;

            m_clearTick = TickHelper.GetTickCount();
            while (m_running)
            {
                long start = TickHelper.GetTickCount();
                int  count = 0;
                try
                {
                    count = ExecuteActions();
                    if (m_clearTick <= start)
                    {
                        m_clearTick += CLEAR_ROOM_INTERVAL;
                        ClearRooms(start);
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Room Mgr Thread Error:", ex);
                }

                //时间补偿
                long end = TickHelper.GetTickCount();

                balance += THREAD_INTERVAL - (end - start);
                if (end - start > THREAD_INTERVAL * 2)
                {
                    log.WarnFormat("Room Mgr is spent too much times: {0} ms,count:{1}", end - start, count);
                }
                if (balance > 0)
                {
                    Thread.Sleep((int)balance);
                    balance = 0;
                }
                else
                {
                    if (balance < -1000)
                    {
                        balance += 1000;
                    }
                }
            }
        }
コード例 #17
0
        private static int ExecuteActions()
        {
            IAction[]       array = null;
            Queue <IAction> actionQueue;

            Monitor.Enter(actionQueue = RoomMgr.m_actionQueue);
            try
            {
                if (RoomMgr.m_actionQueue.Count > 0)
                {
                    array = new IAction[RoomMgr.m_actionQueue.Count];
                    RoomMgr.m_actionQueue.CopyTo(array, 0);
                    RoomMgr.m_actionQueue.Clear();
                }
            }
            finally
            {
                Monitor.Exit(actionQueue);
            }
            if (array != null)
            {
                IAction[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    IAction action = array2[i];
                    try
                    {
                        long tickCount = TickHelper.GetTickCount();
                        action.Execute();
                        long tickCount2 = TickHelper.GetTickCount();
                        if (tickCount2 - tickCount > 40L)
                        {
                            RoomMgr.log.WarnFormat("RoomMgr action spent too much times:{0},{1}ms!", action.GetType(), tickCount2 - tickCount);
                        }
                    }
                    catch (Exception exception)
                    {
                        RoomMgr.log.Error("RoomMgr execute action error:", exception);
                    }
                }
                return(array.Length);
            }
            return(0);
        }
コード例 #18
0
        private static void RoomThread()
        {
            long num = 0L;

            ProxyRoomMgr.m_nextClearTick = TickHelper.GetTickCount();
            ProxyRoomMgr.m_nextPickTick  = TickHelper.GetTickCount();
            while (ProxyRoomMgr.m_running)
            {
                long tickCount = TickHelper.GetTickCount();
                try
                {
                    ProxyRoomMgr.ExecuteActions();
                    if (ProxyRoomMgr.m_nextPickTick <= tickCount)
                    {
                        ProxyRoomMgr.m_nextPickTick += (long)ProxyRoomMgr.PICK_UP_INTERVAL;
                        ProxyRoomMgr.PickUpRooms(tickCount);
                    }
                    if (ProxyRoomMgr.m_nextClearTick <= tickCount)
                    {
                        ProxyRoomMgr.m_nextClearTick += (long)ProxyRoomMgr.CLEAR_ROOM_INTERVAL;
                        ProxyRoomMgr.ClearRooms(tickCount);
                    }
                }
                catch (Exception exception)
                {
                    ProxyRoomMgr.log.Error("Room Mgr Thread Error:", exception);
                }
                long tickCount2 = TickHelper.GetTickCount();
                num += (long)ProxyRoomMgr.THREAD_INTERVAL - (tickCount2 - tickCount);
                if (num > 0L)
                {
                    Thread.Sleep((int)num);
                    num = 0L;
                }
                else
                {
                    if (num < -1000L)
                    {
                        ProxyRoomMgr.log.WarnFormat("Room Mgr is delay {0} ms!", num);
                        num += 1000L;
                    }
                }
            }
        }
コード例 #19
0
        private static void RoomThread()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            long num = 0L;

            RoomMgr.m_clearTick = TickHelper.GetTickCount();
            while (RoomMgr.m_running)
            {
                long tickCount = TickHelper.GetTickCount();
                int  num2      = 0;
                try
                {
                    num2 = RoomMgr.ExecuteActions();
                    if (RoomMgr.m_clearTick <= tickCount)
                    {
                        RoomMgr.m_clearTick += (long)RoomMgr.CLEAR_ROOM_INTERVAL;
                        RoomMgr.ClearRooms(tickCount);
                    }
                }
                catch (Exception exception)
                {
                    RoomMgr.log.Error("Room Mgr Thread Error:", exception);
                }
                long tickCount2 = TickHelper.GetTickCount();
                num += (long)RoomMgr.THREAD_INTERVAL - (tickCount2 - tickCount);
                if (tickCount2 - tickCount > (long)(RoomMgr.THREAD_INTERVAL * 2))
                {
                    RoomMgr.log.WarnFormat("Room Mgr is spent too much times: {0} ms,count:{1}", tickCount2 - tickCount, num2);
                }
                if (num > 0L)
                {
                    Thread.Sleep((int)num);
                    num = 0L;
                }
                else
                {
                    if (num < -1000L)
                    {
                        num += 1000L;
                    }
                }
            }
        }
コード例 #20
0
    public override void SendTCP(GSPacketIn pkg)
    {
        Debug.Log("Sending pkg code " + ((ePackageType)pkg.Code).ToString() + " para1: " + pkg.Parameter1.ToString()
                  + "para2: " + pkg.Parameter2.ToString());

        GameController.LogToScreen("Sending pkg code " + ((ePackageType)pkg.Code).ToString() + " para1: " + pkg.Parameter1.ToString()
                                   + "para2: " + pkg.Parameter2.ToString());
        base.SendTCP(pkg);
        Debug.Log("SEND " + ((ePackageType)pkg.Code).ToString() + " SUCCEED");
        this.m_sentCount++;
        this.m_lastSent       = pkg.Code;
        this.m_lastSentTime   = DateTime.Now;
        this.m_actionInterval = TickHelper.GetTickCount() - this.m_lastSentTick;
        this.m_lastSentTick   = TickHelper.GetTickCount();

        /*if (this.m_log != null)
         * {
         *  this.m_log.WriteLine(Marshal.ToHexDump(string.Format("player [{0}]:{1} sent:", this.m_account, DateTime.Now), pkg.Buffer, 0, pkg.Length));
         * }*/
    }
コード例 #21
0
        public string DisableAllTicket()
        {
            string    ss  = "";
            CDBManger dbm = null;

            try
            {
                dbm = new CDBManger();
                DataTable dt = dbm.ExecuteTable("select distinct t.gcticket_id from cadgis.ticketship t");

                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string GC_ID = dt.Rows[i][0].ToString();
                        CYZLog.writeLog("DisableTicket1(" + GC_ID + ")");
                        if (TickHelper.qxtick1(GC_ID))
                        {
                            ss = "TRUE";
                        }

                        Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString(), "");
                ss = "ERROR:" + ex;
            }
            finally
            {
                if (dbm != null)
                {
                    dbm.close();
                }
            }

            CYZLog.writeLog("End DisableTicket; return " + ss);
            return(ss);
        }
コード例 #22
0
 public ClientConnector(string account, string password, int interval, string ip, int port, ConnectorManager cManager) :
     base(ip, port, false, new byte[0x2000], new byte[0x2000])
 {
     this.m_account        = account;
     this.Password         = password;
     this.m_isHost         = false;
     this.m_timer          = new System.Timers.Timer((double)interval);
     this.m_timer.Elapsed += new ElapsedEventHandler(this.m_timer_Elapsed);
     this.m_queue          = new Queue <PlayerExecutable>();
     this.m_state          = ePlayerState.Init;
     this.m_lastSentTick   = TickHelper.GetTickCount();
     this.m_actionInterval = 0L;
     this.m_recvCount      = 0;
     this.m_sentCount      = 0;
     base.Strict           = true;
     base.Encryted         = true;
     this.connectorManager = cManager;
     this.SetHostIp(ip);
     this.lastErr = eErrorCode.DONE;
     //this.m_log = new StreamWriter(System.IO.File.Create(string.Format("./logs/{0}.log", account)));
 }
コード例 #23
0
ファイル: GameMgr.cs プロジェクト: SkelletonX/DDTServer
        private static void GameThread()
        {
            long balance = 0L;

            GameMgr.m_clearGamesTimer = TickHelper.GetTickCount();
            while (GameMgr.m_running)
            {
                long start = TickHelper.GetTickCount();
                try
                {
                    GameMgr.UpdateGames(start);
                    GameMgr.ClearStoppedGames(start);
                }
                catch (Exception ex)
                {
                    GameMgr.log.Error("Room Mgr Thread Error:", ex);
                }
                long end = TickHelper.GetTickCount();
                balance += GameMgr.THREAD_INTERVAL - (end - start);
                if (balance > 0L)
                {
                    Thread.Sleep((int)balance);
                    balance = 0L;
                }
                else
                {
                    if (balance < -1000L)
                    {
                        GameMgr.log.WarnFormat("Room Mgr is delay {0} ms!", balance);
                        balance += 1000L;
                    }
                }
                if (GameMgr.DELAY_TIME > 0)
                {
                    GameMgr.log.ErrorFormat("Delay for {0} ms!", GameMgr.DELAY_TIME);
                    Thread.Sleep(GameMgr.DELAY_TIME);
                }
            }
        }
コード例 #24
0
        private static void GameThread()
        {
            long balance = 0;

            m_clearGamesTimer = TickHelper.GetTickCount();
            while (m_running)
            {
                long start = TickHelper.GetTickCount();
                try
                {
                    UpdateGames(start);
                    ClearStoppedGames(start);
                }
                catch (Exception ex)
                {
                    log.Error("Room Mgr Thread Error:", ex);
                }

                //时间补偿
                long end = TickHelper.GetTickCount();

                balance += THREAD_INTERVAL - (end - start);

                if (balance > 0)
                {
                    Thread.Sleep((int)balance);
                    balance = 0;
                }
                else
                {
                    if (balance < -1000)
                    {
                        log.WarnFormat("Room Mgr is delay {0} ms!", balance);
                        balance += 1000;
                    }
                }
            }
        }
コード例 #25
0
        public string DisableTicket1(string GC_ID)
        {
            string ss = "";

            try
            {
                CYZLog.writeLog("DisableTicket1(" + GC_ID + ")");

                if (TickHelper.qxtick1(GC_ID))
                {
                    ss = "TRUE";
                    CYZLog.writeLog("撤销成功: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                }
            }
            catch (Exception ex)
            {
                CYZLog.writeLog(ex.ToString());
                ss = "ERROR:" + ex.ToString();
            }

            CYZLog.writeLog("End DisableTicket; return " + ss);
            return(ss);
        }
コード例 #26
0
        private static int ExecuteActions()
        {
            IAction[] actions = null;

            lock (m_actionQueue)
            {
                if (m_actionQueue.Count > 0)
                {
                    actions = new IAction[m_actionQueue.Count];
                    m_actionQueue.CopyTo(actions, 0);
                    m_actionQueue.Clear();
                }
            }

            if (actions != null)
            {
                foreach (IAction ac in actions)
                {
                    try
                    {
                        long begin = TickHelper.GetTickCount();
                        ac.Execute();
                        long end = TickHelper.GetTickCount();
                        if (end - begin > 40)
                        {
                            log.WarnFormat("RoomMgr action spent too much times:{0},{1}ms!", ac.GetType(), end - begin);
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("RoomMgr execute action error:", ex);
                    }
                }
                return(actions.Length);
            }
            return(0);
        }
コード例 #27
0
ファイル: BaseAction.cs プロジェクト: SkelletonX/DDTServer
 public BaseAction(int delay, int finishDelay)
 {
     this.m_tick        = TickHelper.GetTickCount() + (long)delay;
     this.m_finishDelay = (long)finishDelay;
     this.m_finishTick  = 9223372036854775807L;
 }
コード例 #28
0
 public CheckPVEGameStateAction(int delay)
 {
     this.m_time       = TickHelper.GetTickCount() + (long)delay;
     this.m_isFinished = false;
 }
コード例 #29
0
 public WaitPlayerLoadingAction(BaseGame game, int maxTime)
 {
     m_time            = TickHelper.GetTickCount() + maxTime;
     game.GameStarted += new GameEventHandle(game_GameStarted);
 }
コード例 #30
0
 public CheckPVEGameStateAction(int delay)
 {
     m_time       = TickHelper.GetTickCount() + delay;
     m_isFinished = false;
 }