Exemple #1
0
 protected void HeartAsync()
 {
     Task.Factory.StartNew(() =>
     {
         while (_client.IsConnected)
         {
             try
             {
                 if (ActiveTime.AddSeconds(30) <= DateTime.Now)
                 {
                     this.SendMsgAsync(new Message
                     {
                         Protocal = (byte)MessageProtocalEnum.Heart,
                         Sender   = _client.UID
                     });
                 }
                 Thread.Sleep(1000);
             }
             catch (Exception ex)
             {
                 if (ex is SocketException)
                 {
                     ReConnectAsync();
                 }
             }
         }
     });
 }
    //显示样本
    public List <Exchange> getExchangeList(NoticeActiveAndSid[] actives)
    {
        List <Exchange>        list = new List <Exchange>();
        NoticeActiveServerInfo serverInfo;
        NewExchange            exchange;
        ActiveTime             activeTime;
        List <int>             closeSidList = NoticeManagerment.Instance.CloseNoticeSidList;
        int now = ServerTimeKit.getSecondTime();

        foreach (NoticeActiveAndSid active in actives)
        {
            activeTime = ActiveTime.getActiveTimeByID(active.activeID);
            if (activeTime.getIsFinish() || activeTime.getPreShowTime() > now || now > activeTime.getEndTime())
            {
                continue;
            }
            serverInfo = activeInfo.get(active.activeID) as NoticeActiveServerInfo;
            foreach (int sid in active.exchangeSids)
            {
                if (closeSidList.Contains(sid))
                {
                    continue;
                }
                exchange = serverInfo.goodsList.get(sid) as NewExchange;
                if (exchange == null)
                {
                    exchange        = new NewExchange(sid, 0);
                    exchange.timeID = active.activeID;
                    serverInfo.goodsList.put(sid, exchange);
                }
                list.Add(exchange);
            }
        }
        return(list);
    }
 public void initContent(NoticeWindow win, Notice notice)
 {
     mFatherWindow = win;
     this.notice   = notice as DoubleRMBNotice;
     activeTime    = ActiveTime.getActiveTimeByID(notice.sid);
     NoticeSample sample = notice.getSample();
 }
Exemple #4
0
    /** 是否有效 */
    public override bool isValid()
    {
        NoticeSample             noticeSample  = getSample();
        EquipRemakeNoticeContent noticeContent = noticeSample.content as EquipRemakeNoticeContent;

        if (noticeContent != null)
        {
            User user = UserManager.Instance.self;
            if (user.getVipLevel() < noticeContent.getShowVipLevel() || user.getUserLevel() < noticeContent.getShowUserLevel())
            {
                return(false);
            }
        }
        activeTime = ActiveTime.getActiveTimeByID(getSample().timeID);
        if (activeTime.getIsFinish())
        {
            return(false);
        }
        object obj = NoticeActiveManagerment.Instance.getActiveInfoBySid(sid);

        if (obj is DoubleRMBInfo)
        {
            DoubleRMBInfo doubleRMBInfo = obj as DoubleRMBInfo;
            if (doubleRMBInfo != null && doubleRMBInfo.state)
            {
                return(false);
            }
        }
        return(ServerTimeKit.getSecondTime() >= activeTime.getPreShowTime());
    }
Exemple #5
0
    private void clickBuyButton(GameObject obj)
    {
        ActiveTime activeTime = (fatherContent.notice as ConsumeRebateNotice).activeTime;
        int        now        = ServerTimeKit.getSecondTime();

        if (now < activeTime.getDetailStartTime())
        {
            UiManager.Instance.createMessageLintWindow(Language("s0171"));
        }
        else if (now > activeTime.getDetailEndTime())
        {
            UiManager.Instance.createMessageLintWindow(Language("ConsumeRebate_07"));
        }
        else if (activeGoods.getRoleCountCanBuy() < 1)
        {
            UiManager.Instance.createMessageLintWindow(Language("ConsumeRebate_08"));
        }
        else if (activeGoods.getServerCountCanBuy() < 1)
        {
            UiManager.Instance.createMessageLintWindow(Language("ConsumeRebate_09"));
        }
        else if (activeGoods.getSample().rmbCondition > fatherContent.serverInfo.consumeValue)
        {
            UiManager.Instance.createMessageLintWindow(Language("ConsumeRebate_10"));
        }
        else
        {
            UiManager.Instance.openDialogWindow <BuyWindow> ((win) => {
                win.init(activeGoods, Mathf.Min(activeGoods.getServerCountCanBuy(), activeGoods.getRoleCountCanBuy(), UserManager.Instance.self.getRMB() / activeGoods.getCostPrice()),
                         1, activeGoods.getCostType(), buy);
            });
        }
    }
 protected void HeartAsync()
 {
     ws.Send(SerializeHelper.Serialize(new Message {
         Accepter = this.UID,
         Protocal = (byte)MessageProtocalEnum.Login,
         Sender   = this.UID
     }));
     Task.Factory.StartNew(() =>
     {
         while (isConnecting)
         {
             if (ActiveTime.AddSeconds(5) <= DateTime.Now)
             {
                 if (ws.ReadyState == WebSocketState.Open)
                 {
                     ws.Send(SerializeHelper.Serialize(new Message
                     {
                         Sender   = this.UID,
                         Protocal = (byte)MessageProtocalEnum.Heart,
                         Accepter = this.UID
                     }));
                 }
                 else
                 {
                     //ReConnect();
                 }
             }
             Thread.Sleep(100);
         }
     });
 }
 public void CheckConnect(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (ActiveTime.AddSeconds(20) <= DateTime.Now)
     {
         ReConnect();
     }
 }
 void Start()
 {
     db         = GetComponent <DatabaseBattle>();
     selection  = GetComponent <ArrowSelection>();
     logic      = GetComponent <BattleLogic>();
     activeTime = transform.FindChild("PlayerInfo/ActiveTimeBar").GetComponent <ActiveTime>();
 }
Exemple #9
0
    public void initTime()
    {
        TimeInfoSample tsample = TimeConfigManager.Instance.getTimeInfoSampleBySid(timeID);

        activeTime = ActiveTime.getActiveTimeByType(tsample);
        activeTime.initTime(ServerTimeKit.getSecondTime());
    }
Exemple #10
0
 public static void Upsert(this DbContext context, ActiveTime entity)
 {
     context.Database.ExecuteSqlCommand(
         activeTimeTaskUpsertSql,
         new NpgsqlParameter("p0", entity.UserId),
         new NpgsqlParameter("p1", entity.ActiveAt)
         );
 }
 /// <summary>
 /// 设置活动开启时间
 /// </summary>
 public void setNoticeOpenTime()
 {
     this.openTimeNoticeText  = LanguageConfigManager.Instance.getLanguage("LuckyCardContent_timeOpen");
     this.closeTimeNoticeText = LanguageConfigManager.Instance.getLanguage("superDraw_14");
     activeTime      = ActiveTime.getActiveTimeByID(this.notice.getSample().timeID);
     noticeOpenTime  = activeTime.getDetailStartTime();
     noticeCloseTime = activeTime.getDetailEndTime();
 }
Exemple #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            ActiveTime activeTime = db.ActiveTimes.Find(id);

            db.ActiveTimes.Remove(activeTime);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
    private void startTimer()  //开始计时
    {
        timer = TimerManager.Instance.getTimer(UserManager.TIMER_DELAY);
        NoticeSample sample = NoticeSampleManager.Instance.getNoticeSampleBySid(notice.sid);

        activeTime = ActiveTime.getActiveTimeByID(sample.timeID);
        timer.addOnTimer(updateNoticeWindow);
        timer.start();
    }
Exemple #14
0
 /** 是否有效 */
 public override bool isValid()
 {
     activeTime = ActiveTime.getActiveTimeByID(getSample().timeID);
     if (activeTime.getIsFinish())
     {
         return(false);
     }
     return(ServerTimeKit.getSecondTime() >= activeTime.getPreShowTime());
 }
        /// <summary>
        /// Создать копию <see cref="QuikOrderCondition"/>.
        /// </summary>
        /// <returns>Копия.</returns>
        public override OrderCondition Clone()
        {
            var clone = (QuikOrderCondition)base.Clone();

            clone.Offset     = Offset.CloneNullable();
            clone.Spread     = Spread.CloneNullable();
            clone.ActiveTime = ActiveTime.CloneNullable();
            return(clone);
        }
 //キャラクターを行動選択状態にする
 public void OnActive(ActiveTime wTime)
 {
     isNowSelect = true;
     SetInitialActionState();
     ActionSelect.Instance.OnActiveCharacter(this);
     activeCircle.SetActive(true);
     //タイル変更
     BattleStage.Instance.UpdateTileColors(this, TileState.Move);
 }
Exemple #17
0
 public ActionResult Edit([Bind(Include = "Id,Day,Time")] ActiveTime activeTime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activeTime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(activeTime));
 }
Exemple #18
0
        public ActionResult Create([Bind(Include = "Id,Day,Time")] ActiveTime activeTime)
        {
            if (ModelState.IsValid)
            {
                db.ActiveTimes.Add(activeTime);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(activeTime));
        }
Exemple #19
0
    public void setStarMultiple(int timeId, int hit)
    {
        TimeInfoSample tsample = TimeConfigManager.Instance.getTimeInfoSampleBySid(timeId);

        if (starTime == null)
        {
            starTime = ActiveTime.getActiveTimeByType(tsample);
            //starTime.initTime (ServerTimeKit.getSecondTime ());
        }
        this.starHit = hit;
    }
Exemple #20
0
    public override bool isInTimeLimit()
    {
        activeTime = getActiveTime();
        if (activeTime.getIsFinish())
        {
            return(false);
        }
        int now = ServerTimeKit.getSecondTime();

        return(activeTime.getDetailStartTime() < now && now < activeTime.getDetailEndTime());
    }
Exemple #21
0
        private void Read_Current_Session()
        {
            int    counter = 0;
            int    ActiveTime;
            int    itime;
            string sharename;

            try
            {
                oq  = new System.Management.ObjectQuery("SELECT * FROM Win32_ServerConnection");
                oq1 = new System.Management.ObjectQuery("SELECT * FROM Win32_ServerSession");

                ManagementObjectSearcher searcher  = new ManagementObjectSearcher(ms, oq);
                ManagementObjectSearcher searcher2 = new ManagementObjectSearcher(ms, oq1);

                // Read the object
                foreach (ManagementObject ServerQobj in searcher2.Get())
                {
                    RemoteOS  = ServerQobj["ClientType"].ToString();
                    IDealTime = ServerQobj["IdleTime"].ToString();
                    itime     = Int32.Parse(IDealTime) / 60;
                    IDealTime = itime.ToString();
                }
                usname = "";
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    RemoteIPAddress  = queryObj["ComputerName"].ToString();
                    RemoteUserName   = queryObj["UserName"].ToString();
                    RemoteActiveTime = queryObj["ActiveTime"].ToString();
                    ActiveTime       = (Int32.Parse(RemoteActiveTime)) / 60;
                    RemoteActiveTime = ActiveTime.ToString();
                    sharename        = queryObj["ShareName"].ToString();
                    if (!sharename.Equals("IPC$"))
                    {
                        if (usname != "")
                        {
                            usname = usname + " , " + RemoteUserName;
                        }
                        else
                        {
                            usname = RemoteUserName;
                        }
                        Load_Current_Session(counter, RemoteIPAddress, RemoteUserName, RemoteActiveTime, IDealTime, RemoteOS);
                        load_Access_folder(counter, RemoteUserName, sharename);
                        counter += 1;
                    }
                }
            }
            catch (ManagementException e)
            {
                MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
                this.Close();
            }
        }
Exemple #22
0
    public override bool isValid()
    {
        //显示规则策划定
        activeTime = getActiveTime();
        if (activeTime.getIsFinish())
        {
            return(false);
        }
        int now = ServerTimeKit.getSecondTime();

        return(activeTime.getPreShowTime() < now && now < activeTime.getEndTime());
    }
Exemple #23
0
 public ActiveTime getActiveTime()
 {
     if (activeTime == null)
     {
         activeTime = ActiveTime.getActiveTimeByID(getSample().timeID);
     }
     else
     {
         activeTime.doRefresh();
     }
     return(activeTime);
 }
Exemple #24
0
 public override int[] getTimeLimit()
 {
     activeTime = getActiveTime();
     if (activeTime.getIsFinish())
     {
         return(null);
     }
     return(new int[] {
         activeTime.getDetailStartTime(),
         activeTime.getDetailEndTime()
     });
 }
Exemple #25
0
    /// <summary>
    /// 开启计时器
    /// </summary>
    private void startTimer()
    {
        if (timer1 == null)
        {
            timer1 = TimerManager.Instance.getTimer(UserManager.TIMER_DELAY);
        }
        NoticeSample sample = NoticeSampleManager.Instance.getNoticeSampleBySid(notice.sid);

        activeTime1 = ActiveTime.getActiveTimeByID(sample.timeID);
        timer1.addOnTimer(updateNotice);
        timer1.start();
    }
 public override bool isValid()
 {
     activeTime = ActiveTime.getActiveTimeByID(getSample().timeID);
     if (activeTime.getIsFinish())
     {
         return(false);
     }
     if (UserManager.Instance.self.getUserLevel() < getSample().levelLimit)
     {
         return(false);
     }
     return(ServerTimeKit.getSecondTime() >= activeTime.getPreShowTime());
 }
Exemple #27
0
 /// <summary>
 /// 是否有效,请先初始化奖品数据
 /// </summary>
 public bool isValid()
 {
     if (timeID == -1)
     {
         return(false);
     }
     activeTime = ActiveTime.getActiveTimeByID(timeID);
     if (activeTime.getIsFinish())
     {
         return(false);
     }
     return(ServerTimeKit.getSecondTime() >= activeTime.getPreShowTime());
 }
Exemple #28
0
    public static ActiveTime getActiveTimeByID(int activeID)
    {
        TimeInfoSample tsample = TimeConfigManager.Instance.getTimeInfoSampleBySid(activeID);

        if (tsample == null)
        {
            return(null);
        }
        ActiveTime activeTime = getActiveTimeByType(tsample);

        activeTime.initTime(ServerTimeKit.getSecondTime());
        return(activeTime);
    }
    public void initContent(Notice notice, WindowBase win)
    {
        this.notice              = notice as LimitCollectNotice;
        this.win                 = win;
        this.openTimeNoticeText  = LanguageConfigManager.Instance.getLanguage("LuckyCardContent_timeOpen");
        this.closeTimeNoticeText = LanguageConfigManager.Instance.getLanguage("LuckyCardContent_timeOver");
        datas = new List <LimitCollectSample>();
        NoticeSample sample = NoticeSampleManager.Instance.getNoticeSampleBySid(notice.sid);

        sids       = (sample.content as SidNoticeContent).sids;
        activeTime = ActiveTime.getActiveTimeByID(this.notice.getSample().timeID);
        setNoticeOpenTime();
        updateData(sids);
    }
Exemple #30
0
        public void ResetRinger(bool resetAll)
        {
            if (ActiveTime.IsRunning)
            {
                ActiveTime.Stop();
                ActiveTime.Reset();
            }

            if (resetAll && ActiveTimeLong.IsRunning)
            {
                ActiveTimeLong.Stop();
                ActiveTimeLong.Reset();
            }
        }
Exemple #31
0
 //キャラクターを行動選択状態にする
 public void OnActive(ActiveTime wTime)
 {
     isNowSelect = true;
     SetInitialActionState();
     ActionSelect.Instance.OnActiveCharacter(this);
     activeCircle.SetActive(true);
     //タイル変更
     BattleStage.Instance.UpdateTileColors(this, TileState.Move);
 }
Exemple #32
0
    void Start()
    {
        mover = GetComponent<CharacterMover>();
        animator = GetComponent<Animator>();
        skill = GetComponent<CharacterMoveAttack>();
        //singleAttack = GetComponent<CharacterSingleAttack>();
        cameraMove = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraMove>();

        activeTime = ActiveTimeCreater.Instance.CreateActiveTime(this);
        SetActiveTimeEventHandler();
        SetPositionOnTile();
        activeCircle.SetActive(false);
        DisableActionMode();
        CreateCharacterUI();
        //Init();
    }