private void ServerLoop(object sender, DoWorkEventArgs e)
        {
            if (!Connection.StartConnection(CurrentConfig))
            {
                OnConnectionClosed(false);
                return;
            }

            State = PopState.Authorization;
            OnConnectionOpened();

            while (!ShutdownRequested)
            {
                if (CommandQueue.Count > 0)
                {
                    PopCommand Cmd = null;
                    bool       Deq = CommandQueue.TryDequeue(out Cmd);
                    if (!Connection.ExecuteCommand(Cmd))
                    {
                        OnLineSentOrReceived(false, "PopCommand error for " + Cmd.ToString());
                    }
                    System.Threading.Thread.Sleep(100);
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            ShutdownRequested = false;
            Connection.CloseConnection();
            Connection = null;
            OnConnectionClosed(State == PopState.Off);
        }
Beispiel #2
0
        public override void Update(float time)
        {
            switch (_state)
            {
            case PopState.Open:
                _bounds.Y--;
                _bounds.Height += 2;

                if (_bounds.Height >= _maxHeight)
                {
                    _state = PopState.Wait;
                }
                break;

            case PopState.Wait:
                Timer += time;
                if (Timer >= 2500)
                {
                    _state = PopState.Close;
                }
                break;

            case PopState.Close:
                _bounds.Y++;
                _bounds.Height -= 2;
                if (_bounds.Height < 0)
                {
                    Ended = true;
                }
                break;
            }
        }
Beispiel #3
0
 public void PopupMinerInfoOpen(string name)
 {
     string[] temp = name.Split('r');
     _cur_selected_miner_idx = int.Parse(temp[1]);
     _ePop_state             = PopState.MINER_INFO;
     _popup_tm.localScale    = Vector3.one;
     SetMinerInfo();
 }
Beispiel #4
0
    public void startPopup(PopState state, GameObject manager)
    {
        Debug.Log("Popup state : " + state);
        onDestory();
        UIButton btnObj;

        m_state = state;
        isPopup = true;
        bg.SetActive(isPopup);
        Debug.Log("popup check!!!! " + popPenal.transform.childCount);

        switch (m_state)
        {
        case PopState.VIEW_TEXT:
        case PopState.BUY_EQUIP:
            popObj = SKCommon.loadPrefeb("Popup/_PopupOnlyText", popPenal);
            break;

        case PopState.BUY_SHOP:
            popObj = SKCommon.loadPrefeb("Popup/_PopupItemBuyOk", popPenal);

            btnObj = popObj.transform.FindChild("_Btn").GetComponent <UIButton> ();
            EventDelegate.Set(btnObj.onClick, delegate {
                onClicked(0, 0);
            });
            btnObj = popObj.transform.FindChild("_BtnClose").GetComponent <UIButton> ();
            EventDelegate.Set(btnObj.onClick, delegate {
                onClicked(0, 1);
            });
            break;

        case PopState.OPEN_TREASURE:
            popObj = SKCommon.loadPrefeb("Popup/_PopupGetItem", popPenal);
            btnObj = popObj.transform.FindChild("_Btn").GetComponent <UIButton> ();
            EventDelegate.Set(btnObj.onClick, delegate {
                onClicked(0, 0);
            });
            btnObj = popObj.transform.FindChild("_BtnClose").GetComponent <UIButton> ();
            EventDelegate.Set(btnObj.onClick, delegate {
                onClicked(0, 1);
            });
            break;

        case PopState.STAGE_SELECT:
            popObj = SKCommon.loadPrefeb("Popup/_PopupStageSelect", popPenal);
            btnObj = popObj.transform.FindChild("_BtnClose").GetComponent <UIButton> ();
            EventDelegate.Set(btnObj.onClick, delegate {
                onClicked(0, 1);
            });
            break;
        }


        if (state == PopState.VIEW_TEXT || state == PopState.BUY_EQUIP)
        {
            Invoke("onDestory", INVOKE_TIME);
        }
    }
Beispiel #5
0
		public static void POPUP_OPNE(PopState state, GameObject manager)
		{
			GameObject popup = GameObject.FindGameObjectWithTag("popupController");
			if (popup) {
				PopupManager p = popup.GetComponent<PopupManager> ();
				p.startPopup (state, manager);
				p._onPopupBtn += (int type, int tag) => {
					p.onDestory ();
				};
			}
		}
Beispiel #6
0
	public void startPopup (PopState state, GameObject manager)
	{
		Debug.Log("Popup state : "+state);
		onDestory ();
		UIButton btnObj;
		m_state = state;
		isPopup = true;
		bg.SetActive (isPopup);
		Debug.Log ("popup check!!!! " + popPenal.transform.childCount);

		switch (m_state) {
		case PopState.VIEW_TEXT: case PopState.BUY_EQUIP:
			popObj = SKCommon.loadPrefeb("Popup/_PopupOnlyText", popPenal);
			break;
		case PopState.BUY_SHOP:
			popObj = SKCommon.loadPrefeb("Popup/_PopupItemBuyOk", popPenal);
			
			btnObj = popObj.transform.FindChild ("_Btn").GetComponent<UIButton> ();
			EventDelegate.Set (btnObj.onClick, delegate {
				onClicked (0, 0);
			});
			btnObj = popObj.transform.FindChild ("_BtnClose").GetComponent<UIButton> ();
			EventDelegate.Set (btnObj.onClick, delegate {
				onClicked (0, 1);
			});
			break;
		case PopState.OPEN_TREASURE:
			popObj = SKCommon.loadPrefeb("Popup/_PopupGetItem", popPenal);
			btnObj = popObj.transform.FindChild ("_Btn").GetComponent<UIButton> ();
			EventDelegate.Set (btnObj.onClick, delegate {
				onClicked (0, 0);
			});
			btnObj = popObj.transform.FindChild ("_BtnClose").GetComponent<UIButton> ();
			EventDelegate.Set (btnObj.onClick, delegate {
				onClicked (0, 1);
			});
			break;

		case PopState.STAGE_SELECT:
			popObj = SKCommon.loadPrefeb("Popup/_PopupStageSelect", popPenal);
			btnObj = popObj.transform.FindChild ("_BtnClose").GetComponent<UIButton> ();
			EventDelegate.Set (btnObj.onClick, delegate {
				onClicked (0, 1);
			});
			break;
		}


		if (state == PopState.VIEW_TEXT || state == PopState.BUY_EQUIP) {
			Invoke ("onDestory", INVOKE_TIME);
		}
	}
Beispiel #7
0
        public UiPopup(Vector2 position, int width, int height, string text, Color color, Color textColor) : base(position)
        {
            _actualColor = color;
            _maxHeight   = height;
            var prout = (int)((position.Y + (position.Y + height)) / 2);

            _bounds         = new Rectangle((int)position.X, prout, width, 0);
            Height          = height;
            Text            = text;
            this._text      = text;
            this._textColor = textColor;
            _state          = PopState.Open;
        }
Beispiel #8
0
        public static void POPUP_OPNE(PopState state, GameObject manager)
        {
            GameObject popup = GameObject.FindGameObjectWithTag("popupController");

            if (popup)
            {
                PopupManager p = popup.GetComponent <PopupManager> ();
                p.startPopup(state, manager);
                p._onPopupBtn += (int type, int tag) => {
                    p.onDestory();
                };
            }
        }
Beispiel #9
0
    private void SetItemDetail(string item_name)
    {
        switch (item_name)
        {
        case "BtnPotion":
            _lb_title.text       = "<에너지드링크5>";
            _lb_pop_content.text = "5분동안 광부들이 기절하지 않습니다.";
            _need_price          = ENERGY_DRINK_FIVE_PRICE;
            _ePop_state          = PopState.PROTECT_STUN_POTION;
            break;

        case "BtnPotion15":
            _lb_title.text       = "<에너지드링크15>";
            _lb_pop_content.text = "15분동안 광부들이 기절하지 않습니다.";
            _need_price          = ENERGY_DRINK_FIFTEEN_PRICE;
            _ePop_state          = PopState.PROTECT_STUN_POTION_15;
            break;

        case "BtnPartyTicket":
            _lb_title.text       = "<파티티켓1>";
            _lb_pop_content.text = "1분동안 파티를 열어 광부들의\n 이동속도를 2배로 늘립니다.";
            _need_price          = PARTY_TICKET;
            _ePop_state          = PopState.PARTY_TICKET;
            break;

        case "BtnPartyTicket3":
            _lb_title.text       = "<파티티켓3>";
            _lb_pop_content.text = "3분동안 파티를 열어 광부들의\n 이동속도를 2배로 늘립니다.";
            _need_price          = PARTY_TICKET_THREE;
            _ePop_state          = PopState.PARTY_TICKET3;
            break;

        case "BtnEscalator":
            _lb_title.text       = "<에스컬레이터>";
            _lb_pop_content.text = "모든 광부들의 이동속도를 30% 증가 시킵니다.";
            _need_price          = ESCALATOR;
            _ePop_state          = PopState.ESCALATOR;
            break;

        case "BtnWarp":
            _lb_title.text       = "<순간이동장치>";
            _lb_pop_content.text = "일정확률로 광부를 순간이동시킵니다. 쿨타임이 존재합니다";
            _need_price          = WARP;
            _ePop_state          = PopState.WARP;
            break;

        case "BtnMagicPaper":
            _lb_title.text       = "<마법주문서>";
            _lb_pop_content.text = "일정확률로 광부의 골드획득량과 속도를 5%~15% 증가시킵니다. 재구매시 확률은 다시 지정됩니다";
            _need_price          = MAGIC_PAPER;
            _ePop_state          = PopState.MAGIC_PAPER;
            break;
        }
        _lb_pop_level.text = "";
        _lb_pop_price.text = _need_price.ToString();
        _cur_gold          = _miner_mgr.GetTotalGold();
        _lack_gold         = _cur_gold - _need_price;
        if (_lack_gold >= 0)
        {
            _lb_pop_price_lack.text      = "";
            _lb_pop_price_lack_head.text = "";
        }
        else
        {
            _lb_pop_price_lack.text      = _lack_gold.ToString();
            _lb_pop_price_lack_head.text = "부족 : ";
        }
    }
Beispiel #10
0
 private void PopupTraderOpen(string menu_name)
 {
     _ePop_state = PopState.TRADER;
     _popup_trader.localScale = Vector3.one;
 }
Beispiel #11
0
 public void PopupMountainOpen(string menu_name)
 {
     _ePop_state          = PopState.MOUNTAIN;
     _popup_tm.localScale = Vector3.one;
     SetMountainPrice();
 }
Beispiel #12
0
 public void PopupFoodOpen(string menu_name)
 {
     _ePop_state          = PopState.FOOD;
     _popup_tm.localScale = Vector3.one;
     SetFoodPrice();
 }
Beispiel #13
0
 public void PopupMinerRecruitOpen(string menu_name)
 {
     _ePop_state          = PopState.MINER_RECRUIT;
     _popup_tm.localScale = Vector3.one;
     SetRecruitPrice();
 }