コード例 #1
0
 public ShopRechargeOtherController(string uiName)
 {
     sName       = uiName;
     _itemID     = 0;
     ELevel      = UILevel.HIGHT;
     prefabsPath = new string[] { UIPrefabPath.SHOP_RECHARGE_OTHER_WIN };
     MsgCallManager.AddCallback(ProtoID.sc_shop_all_item_base_config, OnShowAllItemBaseConfig); //登录回调
 }
コード例 #2
0
 //红点是否显示
 public AllServerBroadcastController(string uiName)
 {
     sName            = uiName;
     ELevel           = UILevel.TOP;
     prefabsPath      = new string[] { UIPrefabPath.BROADCAST_WIN };
     broadcastContent = new List <string>();
     MsgCallManager.AddCallback((ProtoID.sc_player_sys_notice), ShowBroadcast);
     MsgCallManager.AddCallback(ProtoID.sc_tips, OnServerTip);
 }
コード例 #3
0
    void Awake()
    {
        controller = (PMController)UIManager.GetControler(UIName.PM_WIN);

        inputEditbox = transform.Find("Container/Win/InputText").GetComponent <UIInput>();
        _lb          = inputEditbox.GetComponent <UILabel>();
        UIEventListener.Get(transform.Find("Container/Win/CloseButton").gameObject).onClick = OnClickClose;
        UIEventListener.Get(transform.Find("Container/Win/send").gameObject).onClick        = OnClickButton1;
        MsgCallManager.AddCallback(ProtoID.sc_player_chat, OnChatBack);//登录回调
    }
コード例 #4
0
    public LoginInputController(string uiName)
    {
        sName       = uiName;
        ELevel      = UILevel.HIGHT;
        prefabsPath = new string[] { UIPrefabPath.LOGIN_INPUT_WIN };
        MsgCallManager.AddCallback(ProtoID.SC_LOGIN_REPLY, OnLginReply);                  //登录回调
        EventSystem.RegisterEvent(EventID.SOKECT_CONNECT_RESULT, OnEventSocketConnectOK); //连接socket回调


        GameObject sceneObj = GameObject.Find("Scene");

        if (sceneObj)
        {
            startUpMono = sceneObj.GetComponent <StartUpScene>();
        }
    }
コード例 #5
0
    private void UpdateUIByState(VersionData.VersionType eType)
    {
        switch (eType)
        {
        case VersionData.VersionType.Checking:    //正在检测
            tfBoxChecking.gameObject.SetActive(true);
            tfBoxLoading.gameObject.SetActive(false);
            break;

        case VersionData.VersionType.None:    //无版本要更新,或已更新完成
            tfBoxChecking.gameObject.SetActive(false);
            tfBoxLoading.gameObject.SetActive(false);
            if (_eLastType == VersionData.VersionType.Inner)    //更新完成
            {
                tfBoxLoading.gameObject.SetActive(true);
                loadingTip.text      = "资源更新完成";//GameText.GetStr("updateFinish");
                sliderProgress.value = 1f;

                if (ClientNetwork._bLoginOut)
                {
                    //UIManager.DestroyWin(UIName.MAIN_CITY_WIN);
                    //UIManager.DestroyWin(UIName.MAIN_CITY_CENTER_WIN);
                    ApplicationMgr.KillSelf();    //销毁,让它重新加载配置文件
                    AssetManager.getInstance().ClearAll();
                    ConfigDataMgr.getInstance().ClearAll();
                    GameDataMgr.ClearAll();
                    MsgCallManager.RemoveAllCallback();
                    MsgCallManager.Dispose();
                    EventSystem.Dispose();
                }
                Invoke("OnUpdateVersionComplete", 0.5f);
            }
            else
            {
                //tfJuHuaLoading.gameObject.SetActive(true);
                //if (ClientNetwork._bLoginOut)//如果是註銷出來的
                //{
                //    UIManager.CreateWin(UIName.LOGIN_WIN);
                //    Invoke("DelayToHideVersionUpdate", 0.5f);
                //}
                //else//如果第一次登錄進來
                //{
                //    GameObject sceneObj = GameObject.Find("Scene");
                //    if (sceneObj)
                //    {
                //        StartUpScene startUpMono = sceneObj.GetComponent<StartUpScene>();
                //        if (startUpMono)
                //            startUpMono.StartUp();
                //    }
                //}
                sliderProgress.value = 0f;
                GameObject sceneObj = GameObject.Find("Scene");
                if (sceneObj)
                {
                    StartUpScene startUpMono = sceneObj.GetComponent <StartUpScene>();
                    if (startUpMono)
                    {
                        startUpMono.StartUp();
                    }
                }
            }
            break;

        case VersionData.VersionType.Inner:    //内更资源
            //tfJuHuaLoading.gameObject.SetActive(false);
            tfBoxChecking.gameObject.SetActive(false);
            tfBoxLoading.gameObject.SetActive(true);
            if (_isDownloading == false)                    //提示框
            {
                if (UtilTools.GetCurrentNetworkType() == 1) //wifi
                {
                    tfBoxChecking.gameObject.SetActive(false);
                    tfBoxLoading.gameObject.SetActive(true);
                    tfOKButton.gameObject.SetActive(true);
                    tfSlider.gameObject.SetActive(false);
                    OnClickOKButton(null);
                }
                else
                {
                    tfBoxChecking.gameObject.SetActive(false);
                    tfBoxLoading.gameObject.SetActive(true);
                    loadingTip.text = string.Format("当前非WIFI网络环境,是否继续下载更新包({0})?", GetVersionDataSize());    //"有新版本发布,快去下载吧";//GameText.GetStr("checkTip");
                    tfOKButton.gameObject.SetActive(true);
                    tfSlider.gameObject.SetActive(false);
                    OKButtonText.text = "确定";
                }
            }
            else    //刷进度
            {
                loadingTip.text      = string.Format("下载资源包(编号{0}):  {1}/{2}", GetDownloadingVersion(), GetLoadedSize(), GetVersionDataSize());
                sliderProgress.value = _versionData.GetUpdatePercent();
                tfOKButton.gameObject.SetActive(false);
                tfSlider.gameObject.SetActive(true);
            }
            OKButtonText.text = "更新";    //GameText.GetStr("update");
            break;

        case VersionData.VersionType.Program:    //更新程序版本

            //tfJuHuaLoading.gameObject.SetActive(false);
            if (_isDownloading == false)                                  //提示框
            {
                if (!string.IsNullOrEmpty(SDKManager.PackageDownloadWeb)) //跳网页
                {
                    tfBoxChecking.gameObject.SetActive(false);
                    tfBoxLoading.gameObject.SetActive(true);
                    loadingTip.text = "有新版本发布,快去下载吧";
                    tfOKButton.gameObject.SetActive(true);
                    tfSlider.gameObject.SetActive(false);
                    OKButtonText.text = "更新";
                }
                else if (!string.IsNullOrEmpty(SDKManager.PackageDownloadUrl))    //内部下载
                {
                    if (UtilTools.GetCurrentNetworkType() == 1)
                    {
                        tfBoxChecking.gameObject.SetActive(false);
                        tfBoxLoading.gameObject.SetActive(true);
                        tfOKButton.gameObject.SetActive(true);
                        tfSlider.gameObject.SetActive(false);
                        OnClickOKButton(null);
                    }
                    else
                    {
                        tfBoxChecking.gameObject.SetActive(false);
                        tfBoxLoading.gameObject.SetActive(true);
                        loadingTip.text = string.Format("当前非WIFI网络环境,是否继续下载版本包({0}M)?", VersionData._strPackageSize);    //"有新版本发布,快去下载吧";//GameText.GetStr("checkTip");
                        tfOKButton.gameObject.SetActive(true);
                        tfSlider.gameObject.SetActive(false);
                        OKButtonText.text = "确定";
                    }
                }
                else    //如果没指定更新地址, 就不强制更新.
                {
                    VersionData.ShowTipWhenInToGame = true;
                    UpdateUIByState(VersionData.VersionType.None);    //直接跳过, 在点"进入游戏"时,提示有新版本,请前往更新.
                    return;
                }
            }
            else    //刷内部下载进度
            {
                if (_bLoadPackageFailed)
                {
                    _isDownloading = false;
                    tfBoxChecking.gameObject.SetActive(false);
                    tfBoxLoading.gameObject.SetActive(true);
                    loadingTip.text = string.Format("{0}(错误码:{1})", _strbLoadPackageFailed_msg, _strLoadPackageFailed_code);
                    tfOKButton.gameObject.SetActive(true);
                    tfSlider.gameObject.SetActive(false);
                    OKButtonText.text = "重新下载";
                    return;
                }
                else if (_bLoadPackageComplete)
                {
                    loadingTip.text = string.Format("下载版本包完成,正在安装...");
                }
                else
                {
                    loadingTip.text = string.Format("下载版本包({0}):  {1:F}M / {2:F}M", VersionData._toLoadProgramVersion, loadedPackageSize, totalPackageSize);
                }
                sliderProgress.value = loadedPackageSize / totalPackageSize;
                tfOKButton.gameObject.SetActive(false);
                tfSlider.gameObject.SetActive(true);
            }
            break;

        case VersionData.VersionType.Error:    //更新出错
            VersionData.ErrorCode errorCode = _versionData.ErrorCodeData;
            tfBoxChecking.gameObject.SetActive(false);
            tfBoxLoading.gameObject.SetActive(true);
            loadingTip.text = string.Format("检测版本中断,请检查网络后重试。(错误码:{0})", errorCode);
            tfOKButton.gameObject.SetActive(true);
            tfSlider.gameObject.SetActive(false);
            OKButtonText.text = "确定";
            break;

        default:
            break;
        }
    }
コード例 #6
0
 public void Dispose()
 {
     Pause();
     MsgCallManager.RemoveCallback(ProtoID.SC_COMMON_HEARTBEAT_REPLY, OnMsgHeartBeat);
 }
コード例 #7
0
 public void Start()
 {
     Continue();
     MsgCallManager.AddCallback(ProtoID.SC_COMMON_HEARTBEAT_REPLY, OnMsgHeartBeat);
 }
コード例 #8
0
        public virtual void Update()
        {
            TimerManager.GetInstance().Trigger();
            MsgCallManager.Run();
            EventSystem.update();

            if (sceneCamera != null)
            {
                //点击波纹
                if (nguiCamera != null && Input.GetMouseButtonUp(0))
                {
                    Vector3 p = Input.mousePosition;
                    if (_clickEffect != null)
                    {
                        Ray        uiRay = nguiCamera.ScreenPointToRay(Input.mousePosition);
                        RaycastHit uiHit = new RaycastHit();
                        if (Physics.Raycast(uiRay, out uiHit, 1000, 1 << LayerMask.NameToLayer("ValidViewArea")))
                        {
                            _clickEffect.layer = LayerMask.NameToLayer("UI");
                            _clickEffect.transform.position = uiHit.point;
                            _clickEffect.GetComponent <ParticleSystem>().Play();
                        }
                    }
                }
                if (bCanDrag || bCanClick)
                {
                    if (_bPressed)
                    {
                        Vector3 mousePose = Input.mousePosition;//cam.ScreenToWorldPoint(Input.mousePosition);//hitt.transform.position; //
                        float   offsetX   = mousePose.x - _pressedMousePos.x;
                        if (Mathf.Abs(offsetX) >= 10f)
                        {
                            _bDraging = true;
                        }
                    }
                    if (Input.GetMouseButtonDown(0))//点下去
                    {
                        _pressedMousePos = Input.mousePosition;
                        _bPressed        = false;
                        _bDraging        = false;
                        clickTarget      = null;
                        if (!ClickUI()) //没点到UI
                        {
                            if (bCanClick)
                            {
                                /*if (UIManager.IsWinShow(UIName.BATTLE_SCENE_2D_WIN))
                                 * {
                                 *  clickTarget = ClickSeaHorizontal(out temp_pos);
                                 * }
                                 * else
                                 * {
                                 *  clickTarget = ClickScene(out temp_pos);
                                 * }*/
                                clickTarget = ClickScene(out temp_pos);
                                EventMultiArgs args = new EventMultiArgs();
                                if (clickTarget != null)//有点到东西
                                {
                                    args.AddArg("target", clickTarget);
                                    args.AddArg("hitPos", temp_pos);
                                }
                                args.AddArg("mousePos", _pressedMousePos);
                                EventSystem.CallEvent(EventID.PRESS_SCENE_TARGET, args, true);
                            }
                            _bPressed = true;
                        }
                    }
                    else if (Input.GetMouseButtonUp(0))//弹起
                    {
                        if (!bCanClick)
                        {
                            //不用处理点击事件
                        }
                        else if (clickTarget == null)
                        {
                            //没点到东西
                            EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true);
                        }
                        else if (!bCanDrag && _bDraging)
                        {
                            //手指正在拖动,不用触发点击事件
                            EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true);
                        }
                        else if (bCanDrag && _dragPath != null && _dragPath.IsDraged())
                        {
                            //正在拖动,不用触发点击事件
                        }
                        else if (bCanDrag && _dragInRect != null && _dragInRect.IsDraged())
                        {
                            //正在拖动,不用触发点击事件
                        }
                        else
                        {
                            EventMultiArgs args = new EventMultiArgs();
                            args.AddArg("target", clickTarget);
                            EventSystem.CallEvent(EventID.CLICK_SCENE_TARGET, args, true);
                        }
                        EventSystem.CallEvent(EventID.PRESS_REBOUND_PRESS, new EventMultiArgs(), true);



                        clickTarget = null;
                        _bPressed   = false;
                        _bDraging   = false;
                    }
                }
            }
        }