public void Exit()
 {
     EventCenter.RemoveListener <FEvent>((Int32)GameEventEnum.IntoLobby, OnEvent);
     EventCenter.RemoveListener((Int32)GameEventEnum.GameEvent_SdkLogOff, SdkLogOff);
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_UserExit);
 }
 public void ChangeCoin(int num)
 {
     _Coin += num;
     EventCenter.Broadcast(EventType.Play_CoinUpdate, _Coin);
 }
Exemple #3
0
 private void OnBackButtonClick()
 {
     EventCenter.Broadcast(EventDefine.PlayButtonAudio);
     EventCenter.Broadcast(EventDefine.ShowMianPlane);
     gameObject.SetActive(false);
 }
Exemple #4
0
 public void OnButtonClick()
 {
     AudioMgr.Instance.PlayEffectMusic(StringMgr.Button_Clip);
     UIMgr.Instance.Show(UIPanelName.LevelIntroducePanel);
     EventCenter.Broadcast(EventType.LevelIntroduceUpdate, id);
 }
Exemple #5
0
    private void LuckType(int rand)
    {
        int rand1 = Random.Range(0, 10);

        EventCenter.Broadcast(EventDefine.ReduceLuck);
        EventCenter.Broadcast(EventDefine.UpdateLuckText);
        if (rand <= 2)
        {
            if (isTool == false)
            {
                EventCenter.Broadcast(EventDefine.DoubleScore, 50);
                EventCenter.Broadcast(EventDefine.Hint, "本局+50分");
            }
            else
            {
                EventCenter.Broadcast(EventDefine.Hint, "该模式不支持得分");
            }
        }

        if (rand > 2 && rand <= 6)
        {
            if (isTool == false)
            {
                EventCenter.Broadcast(EventDefine.DoubleScore, 12);
                EventCenter.Broadcast(EventDefine.Hint, "本局+12分");
            }
            else
            {
                EventCenter.Broadcast(EventDefine.Hint, "该模式不支持得分");
            }
        }

        if (rand == 7)
        {
            EventCenter.Broadcast(EventDefine.Hint, "+40钻总数");
            GameManager.Instance.UpdateAllDiamond(40);
        }
        if (rand > 7 && rand <= 12)
        {
            EventCenter.Broadcast(EventDefine.Hint, "+20钻总数");
            GameManager.Instance.UpdateAllDiamond(20);
        }
        if (rand > 12 && rand <= 20)
        {
            EventCenter.Broadcast(EventDefine.Hint, "幸运将在下次降临");
        }
        if (rand > 20 && rand <= 95)
        {
            if (rand1 == 6)
            {
                if (GameManager.Instance.GetSkinUnlocked(3) == false)
                {
                    EventCenter.Broadcast(EventDefine.Hint, "僵尸解锁");
                    GameManager.Instance.SetSkinUnloacked(3);
                }
                else
                {
                    EventCenter.Broadcast(EventDefine.Hint, "已兑换成100钻石");
                    GameManager.Instance.UpdateAllDiamond(100);
                }
            }
            else
            {
                EventCenter.Broadcast(EventDefine.Hint, "幸运将在下次降临");
            }
        }
    }
Exemple #6
0
 public void ChangeHeadID()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_ChangeHeadID);
 }
Exemple #7
0
 public override void OnResume()
 {
     this.gameObject.SetActive(true);
     EventCenter.Broadcast(EventType.PlayBGSound, Audios.Sound_Bg_Moderate);
 }
Exemple #8
0
 /// <summary>
 ///
 /// </summary>
 private void AddGameDiaond()
 {
     gameDiamond++;
     EventCenter.Broadcast(EventDefine.UpdateDiamondText, gameDiamond);
 }
 public void SendTaskStart(Int32 gameEnd, Int32 gameStart)
 {
     EventCenter.Broadcast(gameStart, gameEnd);
 }
Exemple #10
0
 /// <summary>
 /// 增加钻石
 /// </summary>
 private void GetDiamond()
 {
     gameDiamond++;
     EventCenter.Broadcast(EventDefine.UpdateDmdOfPanel, gameDiamond);
 }
Exemple #11
0
 public void Exit()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_SocialExit);
 }
Exemple #12
0
 public void SetGameUserLv(Int16 lv)
 {
     UserLevel = lv;
     EventCenter.Broadcast(EGameEvent.eGameEvent_ChangeUserLevel);
 }
Exemple #13
0
 /// <summary>
 /// 游戏帐号当前金币
 /// </summary>
 /// <param name="num"></param>
 public void GameUserCurGold(UInt64 value)
 {
     mGameUserGold = value;
     EventCenter.Broadcast(EGameEvent.eGameEent_ChangeMoney);
 }
 private void OnConnectServerFail()
 {
     EventCenter.Broadcast <EMessageType>((Int32)GameEventEnum.GameEvent_ShowMessage, EMessageType.EMT_Disconnect);
 }
Exemple #15
0
    private void Update()
    {
        // 是否点击到gameobject,如果点击到则return掉,诺物体取消射线接收则该函数失效
        // 点击屏幕左边的暂停按钮不让人物往左跳跃

        /*  用这两个if情况测会有bug,就是死了之后再点一下才会判断死亡,人物还会再跳一下叫一下
         *     if (Application.platform == RuntimePlatform.Android ||
         *    Application.platform == RuntimePlatform.IPhonePlayer)
         * {
         *    int fingerId = Input.GetTouch(0).fingerId;
         *    if (EventSystem.current.IsPointerOverGameObject(fingerId))
         *    {
         *        return;
         *    }
         * }
         * if (Application.isMobilePlatform)
         * {
         *  int fingerId = Input.GetTouch(0).fingerId;
         *  if (EventSystem.current.IsPointerOverGameObject(fingerId))
         *  {
         *      return;
         *  }
         * }
         * else
         * {
         *    if (EventSystem.current.IsPointerOverGameObject())
         *    {
         *        return;
         *    }
         * }
         */
        if (IsPointerOverGameObject(Input.mousePosition))
        {
            return;
        }
        // 如果游戏结束或者或者游戏暂停或者游戏未开始则不能动
        if (GameManager.Instance.IsGameOver || GameManager.Instance.IsGamePause || GameManager.Instance.IsGameStarted == false)
        {
            return;
        }
        if (Input.GetMouseButton(0) && isJumping == false && nextPlatformLeft != Vector3.zero)
        {
            if (isMove == false)
            {
                EventCenter.Broadcast(EventDefine.PlayerMove);
                isMove = true;
            }
            EventCenter.Broadcast(EventDefine.DecidePath); // 每点击一下生成路径1个
            isJumping = true;
            Vector3 mousePos = Input.mousePosition;        // 获取点击位置
            if (mousePos.x < Screen.width / 2)             // 点击屏幕左边
            {
                isMoveLeft = true;
            }
            if (mousePos.x > Screen.width / 2)  // 点击屏幕右边
            {
                isMoveLeft = false;
            }
            Jump();
        }

        // 游戏结束1
        if (my_Body.velocity.y < -4f && IsRayPlatform() == false &&
            GameManager.Instance.IsGameOver == false)
        {
            spriteRenderer.sortingLayerName        = "Default";
            GetComponent <BoxCollider2D>().enabled = false;
            GameManager.Instance.IsGameOver        = true;
            m_AudioSource.PlayOneShot(vars.fallClip);  // 播放掉落声音
            // 调用结束面板
            StartCoroutine("DelayShowGameOverPanel");
        }

        // 游戏结束2
        if (isJumping && IsRayObstacle() && GameManager.Instance.IsGameOver == false)
        {
            // 播放死亡特效
            GameObject go = ObjectPool.Instance.GetDeathEffect();
            go.transform.position = this.transform.position;
            go.SetActive(true);
            GameManager.Instance.IsGameOver = true;
            spriteRenderer.enabled          = false;
            m_AudioSource.PlayOneShot(vars.hitClip);  // 播放撞死声音
            // 调用结束面板
            StartCoroutine("DelayShowGameOverPanel");
        }
        if (transform.position.y - Camera.main.transform.position.y < -6 &&
            GameManager.Instance.IsGameOver == false)
        {
            GameManager.Instance.IsGameOver = true;
            m_AudioSource.PlayOneShot(vars.fallClip);  // 播放掉落声音
            StartCoroutine("DelayShowGameOverPanel");
        }
        //Debug.DrawRay(rayDown.position, Vector2.down * .5f, Color.red);
        //Debug.DrawRay(rayLeft.position, Vector2.left * .15f, Color.red);
        //Debug.DrawRay(rayRight.position, Vector2.right * .15f, Color.red);
        IsRayPlatform();
    }
Exemple #16
0
    public override void OnPointerDown(PointerEventData eventData)
    {
        if (inventoryMng.isUseItem || inventoryMng.IsSellItem || inventoryMng.IsBuyItem || inventoryMng.IsPickedItem)
        {
            inventoryMng.InitBool();
        }
        EventCenter.Broadcast(EventType.HideToolTip);
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (inventoryMng.IsPickedItem == false && transform.childCount > 0)
            {
                ItemUI currentItemUI = transform.GetChild(0).GetComponent <ItemUI>();
                Item   itemTemp      = currentItemUI.Item;
                DestroyImmediate(currentItemUI.gameObject);
                //脱掉放到背包里面
                transform.parent.parent.SendMessage("PutOff", itemTemp);
            }
        }

        if (eventData.button != PointerEventData.InputButton.Left)
        {
            return;
        }
        // 手上有 东西
        //当前装备槽 有装备
        //无装备
        // 手上没 东西
        //当前装备槽 有装备
        //无装备  不做处理
        bool isUpdateProperty = false;

        if (inventoryMng.IsPickedItem == true)
        {
            //手上有东西的情况
            ItemUI pickedItem = inventoryMng.PickedItem;
            if (transform.childCount > 0)
            {
                ItemUI currentItemUI = transform.GetChild(0).GetComponent <ItemUI>();//当前装备槽里面的物品

                if (IsRightItem(pickedItem.Item))
                {
                    inventoryMng.PickedItem.Exchange(currentItemUI);
                    isUpdateProperty = true;
                }
            }
            else
            {
                if (IsRightItem(pickedItem.Item))
                {
                    this.StoreItem(inventoryMng.PickedItem.Item);
                    inventoryMng.RemoveItem(1);
                    isUpdateProperty = true;
                }
            }
        }
        else
        {
            //手上没东西的情况
            if (transform.childCount > 0)
            {
                ItemUI currentItemUI = transform.GetChild(0).GetComponent <ItemUI>();
                inventoryMng.PickupItem(currentItemUI.Item, currentItemUI.Amount);
                Destroy(currentItemUI.gameObject);
                isUpdateProperty = true;
            }
        }
        if (isUpdateProperty)
        {
            transform.parent.parent.SendMessage("UpdatePropertyText");
        }
    }
Exemple #17
0
 public void ChangeNickName()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_ChangeNickName);
 }
Exemple #18
0
 /// <summary>
 /// 返回按钮点击
 /// </summary>
 private void OnBackButtonClick()
 {
     gameObject.SetActive(false);
     EventCenter.Broadcast(EventDefine.ShowLoginPanel);
 }
Exemple #19
0
 public void Enter()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_PresonInfoEnter);
 }
 private void logoutBtn_Click(object sender, RoutedEventArgs e)
 {
     this.Close();
     EventCenter.Broadcast(EventType.Logout);
 }
Exemple #21
0
    //对拖动结束事件的响应
    //对装备栏或仓库进行操作
    public void DragAndDrop_OnLeftEndDrag(Transform prevTransfrom, Transform enterTransfrom)
    {
        //隐藏中间图标
        //icon.GetComponent<RectTransform>().anchoredPosition = new Vector2(-100f, -100f);
        //icon.SetActive(false);

        ModuleSelectUI msu;
        ModuleSlot     prevms;
        ModuleSlot     enterms;

        //首先判断被拖动起始位置是什么格子
        if (prevTransfrom.tag.Equals("ModuleSelection"))//如果起始位置是仓库
        {
            //获取起始位置的引用
            msu = prevTransfrom.GetComponent <ModuleSelectUI>();

            //接下来判断拖动结束位置
            if (enterTransfrom.tag.Equals("ModuleSlot"))//如果结束位置是装备栏,则提取仓库中的模块赋值给装备栏对应位置
            {
                enterms = enterTransfrom.GetComponent <ModuleSlot>();
                PlayerManager.instance.ModuleMap[enterms.rawIndex, enterms.rolIndex] = PlayerManager.instance.GetModule(msu.Index);
                mSlots.UpdateModuleShow();
            }
            else //除此之外的其他地方什么都不做
            {
            }
        }
        else if (prevTransfrom.tag.Equals("ModuleSlot"))//如果起始位置是装备栏
        {
            //获取起始位置的引用
            prevms = prevTransfrom.GetComponent <ModuleSlot>();

            //接下来判断拖动结束位置
            if (enterTransfrom.tag.Equals("ModuleSlot"))//如果结束位置是装备栏,则与装备栏对应模块换位
            {
                enterms = enterTransfrom.GetComponent <ModuleSlot>();
                PlayerManager.instance.SwitchModule(prevms.rawIndex, prevms.rolIndex, enterms.rawIndex, enterms.rolIndex);
                //mSlots.UpdateModuleShow();
            }
            else //如果是其他位置,则将原位置设为空模块
            {
                PlayerManager.instance.ModuleMap[prevms.rawIndex, prevms.rolIndex] = PlayerManager.instance.NewModule(ModuleType.None);
            }
            //更新模块显示
            mSlots.UpdateModuleShow();
        }

        //判断是否报错
        if (PlayerManager.instance.CheckModNum())
        {
            if (!PlayerManager.instance.CheckCore())
            {
                EventCenter.Broadcast <string>(EventCode.ShowErrMsg, "机甲只能装备一个核心");
            }
            else
            {
                EventCenter.Broadcast(EventCode.HideErrMsg);
            }
        }

        PlayerManager.instance.PowerCal();
    }
Exemple #22
0
 public void Exit()
 {
     EventCenter.Broadcast(EGameEvent.eGameEvent_ExtraBonusExit);
 }
 private void AddDiamond()
 {
     gameDiamond++;
     EventCenter.Broadcast(EventType.updateDiamondText, gameDiamond);
 }
Exemple #24
0
 public void Enter()
 {
     EventCenter.Broadcast(EGameEvent.eGameEvent_ExtraBonusEnter);
 }
Exemple #25
0
    private void Update()
    {
        t2 = t2 + Time.deltaTime;
        if (Input.GetKeyDown(KeyCode.A))
        {
            if (t2 > 1.2f)
            {
                int rand = Random.Range(0, 25);

                if (GameManager.Instance.GetLuck() != 0)
                {
                    LuckType(rand);
                    t2 = 0f;
                }
                else
                {
                    EventCenter.Broadcast(EventDefine.Hint, "幸运器不足");
                    t2 = 0f;
                }
            }
            else
            {
                EventCenter.Broadcast(EventDefine.Hint, "操作频繁");
            }
        }



        if (IsPointerOverGameObject(Input.mousePosition))
        {
            return;
        }

        if (GameManager.Instance.IsGameStarted == false || GameManager.Instance.IsGameOver == true || GameManager.Instance.IsPause == true)//游戏开始或者游戏未结束玩家可移动
        {
            return;
        }
        if (Input.GetMouseButtonDown(0) && isJumping == false)
        {
            if (isMove == false)
            {
                EventCenter.Broadcast(EventDefine.PlayerMove);
                isMove = true;
            }
            m_AudioSource.PlayOneShot(vars.jumpClip);
            EventCenter.Broadcast(EventDefine.DecidePath);
            Vector3 mousePos = Input.mousePosition;
            isJumping = true;
            //点击的是左边屏幕
            if (mousePos.x <= Screen.width / 2)
            {
                Debug.Log("左");
                isMoveLeft = true;
            }
            //点击的右边屏幕
            else if (mousePos.x > Screen.width / 2)
            {
                Debug.Log("右");
                isMoveLeft = false;
            }
            Jump();
        }

        if (my_Body.velocity.y < 0 && IsRayPlatform() == false && GameManager.Instance.IsGameOver == false)
        {
            m_AudioSource.PlayOneShot(vars.fallClip);
            spriteRenderer.sortingLayerName        = "Default";
            GetComponent <BoxCollider2D>().enabled = false;
            GameManager.Instance.IsGameOver        = true;

            StartCoroutine(DealyShowGameOverPanel());
        }

        if (isJumping && IsRayObstacle() && GameManager.Instance.IsGameOver == false)
        {
            m_AudioSource.PlayOneShot(vars.hitClip);
            GameObject go = ObjectPool.Instance.GetDeathEffect();
            go.SetActive(true);
            go.transform.position           = transform.position;
            spriteRenderer.enabled          = false;
            GameManager.Instance.IsGameOver = true;    //游戏结束

            StartCoroutine(DealyShowGameOverPanel());
        }
        if (transform.position.y - Camera.main.transform.position.y < -6 && GameManager.Instance.IsGameOver == false)
        {
            m_AudioSource.PlayOneShot(vars.fallClip);
            GameManager.Instance.IsGameOver = true;//游戏结束

            StartCoroutine(DealyShowGameOverPanel());
        }
    }
Exemple #26
0
 public void Enter()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_ExtraBonusEnter);
 }
 public void ChangeRound()
 {
     EventCenter.Broadcast(EventType.Play_NowRoundUpdate, nowRound);
 }
Exemple #28
0
    private IEnumerator DelayShowGameOverPanel()
    {
        yield return(new WaitForSeconds(2f));

        EventCenter.Broadcast(EventDefine.ShowGameOverPanel);
    }
Exemple #29
0
 public void Exit()
 {
     EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_GameSettingExit);
 }
Exemple #30
0
 /// <summary>
 /// 点击登录按钮
 /// </summary>
 public void OnLoginBtnClicked()
 {
     EventCenter.Broadcast(EventTypes.RequestAuth, null);
 }