void Update() { #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX if (Input.GetMouseButtonUp(0)) { if (tip != null) { Destroy(tip.gameObject); tip = null; } } #elif UNITY_IPHONE || UNITY_ANDROID if (Input.touchCount > 0) { if (Input.GetTouch(0).phase == TouchPhase.Ended) { if (tip != null) { Destroy(tip.gameObject); tip = null; } } } #endif }
private void OnItemPickUp(GameEvent ge, EventParameter parameter) { MsgData_sPickUpItem data = parameter.msgParameter as MsgData_sPickUpItem; if (null == data) { return; } for (int i = 0; i < data.Data.Count; i++) { PickUpItem_Result result = data.Data[i]; if (0 == result.Result)//0:成功 { hasAddedItems.Remove(result.ID); PickDropItem(result.ID); } else if (-1 == result.Result)//-1:物品不存在 { hasAddedItems.Remove(result.ID); //LogMgr.UnityError("物品不存在 " + result.ID); } else if (-2 == result.Result)//-2:不属于该玩家 { UITips.ShowTips("该物品不属于您"); } else if (-3 == result.Result)//-3:背包已满 { UITips.ShowTips("背包已满,拾取失败"); } } }
/// <summary> /// 显示系统公告。 /// </summary> /// <param name="id">公告编号。</param> /// <param name="param">公告参数。</param> public void ShowSystemNotice(int id, string param) { LuaTable cfg = ConfigManager.Instance.Common.GetSystemNoticeConfig(id); if (cfg == null) { LogMgr.LogWarning("Unknow system notice id:{0}", id); return; } //解析消息内容 string text = ParseNotice(cfg, param); int channel = cfg.Get <int>("channel"); //是否信息漂浮额外提示 if (cfg.Get <int>("type") == 4) { UITips.ShowTips(text); } //系统提示信息0号频道不在聊天信息 if (channel != 0) { ChatMessage chat = new ChatMessage(1, channel, text); AddMessage(chat); TriggerEventSystemNotice(chat); } }
/// <summary> /// 收到重连消息 /// </summary> /// <param name="msg"></param> private void RespReconnect(MsgData msg) { MainPanelMgr.Instance.HideDialog("UIWaitDialog"); MsgData_sReconnect data = msg as MsgData_sReconnect; if (null == data) { return; } if (data.Result == 0)//重连成功 { UITips.ReconnectSwitchLine(); } else if (data.Result == 1)//认证失败 { UITips.ShowTipsDialog("提示", "认证失败,请重新登录", "确定", RequestToLogin, null, null); } else if (data.Result == 2)//重连失败 { UITips.ShowTipsDialog("提示", "您已经断开连接,请重新登录", "确定", RequestToLogin, null, null); } else if (data.Result == 3) { UITips.ShowTipsDialog("提示", "连接失败,请重新登录", "确定", RequestToLogin, null, null); } }
// Use this for initialization void Start() { if (tip != null) { Destroy(tip.gameObject); } tip = this; }
void onEnemyLeave() { gm.enemyBall.gameObject.SetActive(false); UITips.PopUp(new UITipsParam() { Confirm = LanguageManager.GetText("Confirm"), Title = LanguageManager.GetText("Tip"), Content = LanguageManager.GetText("EnemyLeave"), Callback = () => { SceneManager.LoadScene("initScene"); } }); }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
private void EndLoadScene(GameEvent ge, EventParameter parameter) { isLoadScene = false; if (disconnectInLoad) { disconnectInLoad = false; //IsShowReconnectedDialog = true; UITips.ShowTipsDialog("提示", "您已经断开连接,请重新登录", "确定", RequestToLogin, null, RequestToLogin); } }
private void OnNetworkStatusChanged(NetworkStatusEventParam status) { switch (status) { case NetworkStatusEventParam.Closed: UITips.PopUp(new UITipsParam() { Content = "aaaaaa", Callback = () => { SceneManager.LoadScene("initScene"); } }); break; } }
private void ShowUIAsync_Tips(int uiid, Action <UIBase, int> callback = null, params object[] argv) { ResMgr.Log(Tag, "ShowUIAsync", "==>" + uiid); UITips ub = (UITips)_ins.m_uicache[uiid]; if (ub == null) { Action <GameObject> cb = (go) => { if (m_uiRoot == null) { Debug.Log("muiRoot is null"); } go.transform.SetParent(m_uiRoot.transform, false); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; ub = go.GetComponent <UITips>(); ub.argv = argv; ub.OnShowTips(); _ins.m_uicache[uiid] = ub; if (callback != null) { callback(ub, uiid); } }; LoadUIAsync(uiid, cb); } else { ub.argv = argv; ub.gameObject.SetActive(true); ub.OnShowTips(); if (ub.IsNeedMask) { if (!m_bgMask.gameObject.activeInHierarchy) { m_bgMask.Show(); } m_bgMask.transform.SetSiblingIndex(-2); } ub.transform.SetAsLastSibling(); if (callback != null) { callback(ub, uiid); } } }
/// <summary> /// 发送改变乘骑状态的请求。 /// </summary> public void SendChangeRideStateRequest(int state) { if (PlayerData.Instance.BaseAttr.GetUnitBit((int)UnitBit.UNIT_BIT_IN_PK) && state != 0) { UITips.ShowTips("PK状态中,无法上坐骑"); return; } if (mRideState == state) { return; } MsgData_cChangeRideState data = new MsgData_cChangeRideState(); data.RideState = state; CoreEntry.netMgr.send((Int16)NetMsgDef.C_CHANGE_RIDE_STATE, data); }
void OnTriggerEnter(Collider collider) { ActorObj actor = collider.GetComponent <ActorObj>(); if (null == actor) { return; } if (actor != CoreEntry.gActorMgr.MainPlayer) { return; } if (m_IgnoreEnter) { return; } if (PlayerData.Instance.BaseAttr.Level < m_PortalCfg.Get <int>("limitLv")) { string msg = string.Format("人物等级不足{0}级,无法传送!", m_PortalCfg.Get <int>("limitLv")); UITips.ShowTips(msg); LogMgr.LogWarning(msg + "(客户端主动判断)"); return; } if (PlayerData.Instance.BaseAttr.JingJieLevel < m_PortalCfg.Get <int>("dianfengLv")) { string msg = string.Format("人物境界等级不足{0}级,无法传送!", m_PortalCfg.Get <int>("dianfengLv")); UITips.ShowTips(msg); LogMgr.LogWarning(msg + "(客户端主动判断)"); return; } if (m_PortalCfg.Get <int>("type") == 3) //活动地图传送门 --世界BOSS,银两BOSS等 { ActivityMgr.Instance.Send_CS_ActivityEnter(m_PortalCfg.Get <int>("targetActivity")); } else { // CoreEntry.gActorMgr.MainPlayer.StopMove(true); NetLogicGame.Instance.SendReqStaticTrigger(serverID); } }
private static void _ShowTips() { if (0 == tipsQueue.Count) { showing = false; return; } showing = true; TipsData tips = tipsQueue.Dequeue(); UIManager.OpenUI("Prefabs/TipsUI", UIManager.Instance.TipsUIRoot, (GameObject obj) => { UITips uiTips = obj.GetComponent <UITips>(); uiTips.StartShow(tips); Scheduler.Instance.CreateScheduler("tips" + Function.GetServerTime(), tips.stayTime, 1, 0, (param) => { UIManager.CloseUI("Prefabs/TipsUI"); _ShowTips(); }); }); }
private void OnRevive(GameEvent ge, EventParameter parameter) { MsgData_sRevive data = parameter.msgParameter as MsgData_sRevive; if (null == data) return; if (0 == data.Result) { ActorObj actor = CoreEntry.gActorMgr.GetActorByServerID(data.RoleID); if (null == actor) return; if (PlayerData.Instance != null) { PlayerData.Instance.ReviceHideLessTime = 0; } actor.SetPosition((float)data.PosX, (float)data.PosY); actor.ForceToRevive(); //StartCoroutine(DoRevive(actor)); } else if (-1 == data.Result) { UITips.ShowTips("5s限制时间已过"); } else if (-2 == data.Result) { //UITips.ShowTips("非死亡不能复活"); } else if (-3 == data.Result) { UITips.ShowTips("道具不足"); } else if (-4 == data.Result) { UITips.ShowTips("钻石不足"); } else if (-5 == data.Result) { UITips.ShowTips("不可原地复活"); } }
/// <summary> /// 显示公告。 /// </summary> /// <param name="id">公告编号。</param> /// <param name="param">公告参数。</param> public void ShowNotice(int id, string param) { LuaTable cfg = ConfigManager.Instance.Common.GetNoticeConfig(id); if (cfg == null) { LogMgr.LogWarning("Unknow notice id:{0}", id); return; } //解析消息内容 string text = id == SpecialNoticeID?ParseSpecialNotice(param) : ParseNotice(cfg, param); int channel = cfg.Get <int>("channel"); //是否走马灯显示 string pos = cfg.Get <string>("pos"); if (pos.IndexOf("1") != -1 || pos.IndexOf("2") != -1) { //登录和选角不弹走马灯 if (MapMgr.Instance.CurMapType != MapMgr.MapType.Map_Login && MapMgr.Instance.CurMapType != MapMgr.MapType.Map_SelectRole) { UITips.ShowNotice(text); } } if (pos.IndexOf("4") != -1) { ChatMessage chat = new ChatMessage(1, channel, text); AddMessage(chat); TriggerEventNotice(chat); } if (pos.IndexOf("5") != -1) { UITips.ShowTips(text); } }
void GE_THIRDPARTY_EXIT(GameEvent ge, EventParameter parameter) { if (parameter.intParameter == 0) { // TipsDialog.SetTipsText("确认退出游戏?", new TipsDialog.OnDelegateClick(() => // { // DataAnalyser.instance.Exit(); // Application.Quit(); // })); UITips.ShowTipsDialog("提示", "确认退出游戏?", "确定", new System.Action(() => { SDKMgr.Instance.Exit(); Application.Quit(); }), "取消", new System.Action(() => { MainPanelMgr.Instance.HideDialog("UICommonTk"); })); } else if (parameter.intParameter == 1) { SDKMgr.Instance.Exit(); Application.Quit(); } }
/// <summary> /// 背包扩充回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnExpandBag(MsgData data) { MsgData_sExpandBagResult info = data as MsgData_sExpandBagResult; LogMgr.Log("背包扩充回复 bag:{0} size:{1} result:{2}", info.Bag, info.NewSize, info.Result); if (info.Result == 0) { //背包扩充成功 BagInfo bag = GetBagInfo(info.Bag); if (bag != null) { int oldsize = bag.Size; bag.Size = info.NewSize; bag.OpenLastTime = ConfigManager.Instance.BagItem.GetOpenNeedTime(info.Bag, info.NewSize); TriggerEventBagSize(bag.BagType, oldsize, info.NewSize); //只提示通用背包开启 if (info.Bag == BagType.ITEM_BAG_TYPE_COMMON) { string msg = string.Format("成功开启{0}格背包!", info.NewSize - oldsize); UITips.ShowTips(msg); } } } }
void Update() { if (CoreEntry.gCameraMgr.MainCamera == null) { return; } if (CoreEntry.gJoystickMgr.IsTouch()) { cancelAuto = false; // ChangeMouseTexture(TargetType.none); return; } if (targetObj != null) { if (!NpcMgr.Instance.bInArea(targetObj.gameObject.transform.position, 10)) { targetObj.SelectNpc(targetObj, false); targetObj = null; } } if ((DateTime.Now - dt).TotalSeconds < 1) { return; } if (Application.isMobilePlatform) { if (Input.touchCount > 0) { if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) { cancelAuto = false; return; } } } //Button ss; #if UNITY_EDITOR || UNITY_STANDALONE if (Input.GetMouseButtonDown(0)) #else int count = Input.touchCount; if (count <= 0) { return; } Touch touch = Input.GetTouch(0); if (TouchPhase.Began == touch.phase) #endif { #if IPHONE || ANDROID if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) { cancelAuto = false; return; } #else if (EventSystem.current.IsPointerOverGameObject()) { cancelAuto = false; //过滤穿透 return; } #endif //UnityEngine.UI.GraphicRaycaster gray = this.GetComponent<UnityEngine.UI.GraphicRaycaster>(); Ray ray = CoreEntry.gCameraMgr.MainCamera.ScreenPointToRay(Input.mousePosition);//从摄像机发出到点击坐标的射线 RaycastHit hitInfo; //TargetType curTargetType = TargetType.none; //初始化点击光标显示类型 if (Physics.Raycast(ray, out hitInfo, float.PositiveInfinity, mClickMask)) { // LogMgr.DrawLine(ray.origin, hitInfo.point);//划出射线,只有在scene视图中才能看到 GameObject gameObj = hitInfo.collider.gameObject; if (!gameObj.CompareTag("Untagged")) { cancelAuto = false; //LogMgr.UnityLog("click object name is " + gameObj.name); //LogMgr.UnityLog("gameObj.tag " + gameObj.tag); //obj tag层 if (gameObj.tag.Equals("npc") || gameObj.tag.Equals("collect") || gameObj.tag.Equals("monster") || gameObj.tag.Equals("player") || gameObj.tag.Equals("boss")) { CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_MyTakeAction, EventParameter.Get()); //int distance = 0; //int campId = 0; if (gameObj.tag.Equals("npc")) { //curTargetType = TargetType.handerType1; int cid = gameObj.GetComponent <NpcObj>().ConfigID; //npcConfig cf = npcExcel.GetRecord<npcConfig>(cid); LuaTable cfg = ConfigManager.Instance.Actor.GetNPCConfig(cid); if (cfg == null) { LogMgr.LogError("NPC配置表中不存在 resid: " + cid); return; } if (cfg.Get <int>("open_dialog") < 1) //该NPC不能进行对话 { return; } //distance = cfg.Get<int>("open_dis"); //campId = cfg.Get<int>("camp"); } if (gameObj.tag.Equals("collect")) { //curTargetType = TargetType.handerType1; CollectionType mType = gameObj.GetComponent <CollectionObj>().Type; if (mType == CollectionType.ME || mType == CollectionType.FRIEND) { //公会战判断。 己方军旗 return; } int cid = gameObj.GetComponent <CollectionObj>().ConfigID; long serverId = gameObj.GetComponent <CollectionObj>().ServerID; LuaTable cfg = ConfigManager.Instance.Map.GetCollectionConfig(cid); if (cfg == null) { LogMgr.LogError("采集配置表中不存在 resid: " + cid); return; } if (cfg.Get <int>("click") != 1) { return; } if (NpcMgr.Instance.bInArea(gameObj.transform.position, cfg.Get <int>("distance")) == false) { Debug.Log("距离不够"); return; } if (bCollectFinish) { int num = cfg.Get <int>("cast_time"); bCollectFinish = false; MsgData_cStructDef rsp = new MsgData_cStructDef(); rsp.cID = serverId; if (rsp.cID > 0) { LogMgr.Log("发送采集请求rsp.cID " + rsp.cID); CoreEntry.netMgr.send((Int16)NetMsgDef.C_STRUCT_DEF, rsp); } //TaskMgr.Instance.Send_CS_CollectData(cid); UITips.ShowSliderProgress(cfg.Get <string>("tips"), num, () => { bCollectFinish = true; }); gameObj.GetComponent <CollectionObj>().SelectTarget(); }/* * Debug.LogError("采集cid "+ cid); * UITips.ShowSliderProgress("采集中", cfg.Get<int>("cast_time")/1000,() => { * Debug.LogError("11111"); * }); */ } if (gameObj.tag.Equals("monster") || gameObj.tag.Equals("boss") || gameObj.tag.Equals("collect")) { ActorObj monster = gameObj.GetComponent <ActorObj>(); ActorObj mainplayer = CoreEntry.gActorMgr.MainPlayer; if (monster != null) { if (mainplayer.m_SelectTargetObject == monster) { LogMgr.DebugLog("点击选中同一个目标"); CoreEntry.gAutoAIMgr.AutoFight = true; } else { if ((monster is MonsterObj) && monster.IsSameCamp()) { //同阵营的怪物不能被选中! } else { mainplayer.SelectTarget(monster); } } } return; } //PK选择目标 if (gameObj.tag.Equals("player")) { ActorObj mainplayer = CoreEntry.gActorMgr.MainPlayer; OtherPlayer player = gameObj.GetComponent <OtherPlayer>(); if (player != null) { mainplayer.SelectTarget(player); return; } } dt = DateTime.Now; //过滤多次发送。 // if (TaskMgr.Instance.bInArea(hitInfo.point,distance)) //cf.open_dis 对话半径 if (NpcMgr.Instance.bInArea(hitInfo.point, 3)) { if (gameObj.tag.Equals("npc")) { targetObj = gameObj.GetComponent <ActorObj>(); NpcMgr.Instance.OpenNpcTk(targetObj.ConfigID); //LuaTable camp = ConfigManager.Instance.Common.GetCampConfig(campId); //ActorObj mainplayer = CoreEntry.gActorMgr.MainPlayer; //if (targetObj != null) //{ // if (mainplayer.m_SelectTargetObject == targetObj) // { // LogMgr.LogError("点击选中同一个目标"); // CoreEntry.gAutoAIMgr.AutoFight = true; // } // else // { // if ((targetObj is ActorObj) && targetObj.IsSameCamp()) // { // //同阵营的怪物不能被选中! // } // else // { // mainplayer.SelectTarget(targetObj); // } // } //} targetObj.SetTarget(targetObj); targetObj.SelectNpc(targetObj, true); } else if (gameObj.tag.Equals("collect")) { } else if (gameObj.tag.Equals("player")) { } else { } } else { if (bMove) { Vector3 go = hitInfo.point; LogMgr.Log("距离不够,点击移动"); TaskMgr.Instance.MoveToPos(go); // bMove = false; } } } } else { if (gameObj.layer == LayerMask.NameToLayer("ground") && CoreEntry.gJoystickMgr.IsShow && !ArenaMgr.Instance.IsArenaFight) { int mapid = MapMgr.Instance.EnterMapId; var info = ConfigManager.Instance.Map.GetMapConfig(mapid); if (info != null && info.GetInPath <int>("type") == 42)//如果是竞技场 不给人物行走 { return; } Vector3 pos = hitInfo.point; ActorObj mainActor = CoreEntry.gActorMgr.MainPlayer; if (!SceneDataMgr.Instance.IsBlocked(pos) && null != mainActor) { if (mainActor.GetCurState() == ACTOR_STATE.AS_STAND || mainActor.GetCurState() == ACTOR_STATE.AS_RUN || mainActor.GetCurState() == ACTOR_STATE.AS_NONE) { if (mainActor.AutoPathFind && !cancelAuto) { cancelAuto = true; UITips.ShowTips("再次点击取消自动寻路"); return; } CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_MyTakeAction, EventParameter.Get()); //CoreEntry.gGameMgr.AutoFight = false; TaskMgr.bRunAndTasking = false; CoreEntry.gActorMgr.MainPlayer.ShowMoveArrow(pos); CoreEntry.gActorMgr.MainPlayer.MoveToPos(pos); } } } } //targetType = curTargetType; } } // ChangeMouseTexture(targetType); //更改鼠标光标 }
public void OnClick(GameObject obj) { if (buttonindex == (int)enSkillIndex.Player_Skill_Beauty && PlayerData.Instance.BaseAttr.Level < BeautyOpenLevel) { //UITips.ShowTips(string.Format("魔神变身{0}级开放", BeautyOpenLevel)); UITips.ShowUnHeroModelShow(); return; } if (buttonindex == (int)enSkillIndex.Player_Skill_Beauty) { if (m_ImageDisable.gameObject.activeSelf) { // UITips.ShowTips(string.Format("您未获得魔神")); UITips.ShowUnHeroModelShow(); return; } else { if (guidewidget != null) { guidewidget.OnButtonClick(); } if (m_ImageCD.fillAmount < 1) { string strTips = Localization.Get("技能冷却中"); if (strTips.Length > 0) { UITips.ShowTips(strTips); } } } } if (m_ImageDisable.gameObject.activeSelf) { if (buttonindex == (int)enSkillIndex.Player_Skill_WangzheVip) { MainPanelMgr.Instance.ShowDialog("UIBaiYinVIP"); return; } UITips.ShowTips(string.Format("该技能尚未解锁")); return; } if (skillID == 0) { return; } if (CoreEntry.gActorMgr.MainPlayer != null) { if (buttonindex == (int)enSkillIndex.Player_att || buttonindex == (int)enSkillIndex.Beauty_att) { CoreEntry.gActorMgr.MainPlayer.ReleaseCanNotBeControlledByInputFromNormalAttack(); } } LuaTable skill = ConfigManager.Instance.Skill.GetSkillConfig(skillID); if (skill == null) { return; } if (SkillBase.GetSkillVersion(CoreEntry.gActorMgr.MainPlayer, skill) == 2 && CoreEntry.gActorMgr.MainPlayer.curActorState != ACTOR_STATE.AS_AIMING) { return; } SDKMgr.Instance.TrackGameOptLog(1, 500 + buttonindex); m_isDrag = false; //m_isClick = false; // 按住不能放技能 m_sendRatio = 0.05f; if (buttonindex == (int)enSkillIndex.Player_Skill_Beauty) { LogMgr.UnityWarning("Player_Skill_Beauty:" + skillID); } ModuleServer.MS.GSkillCastMgr.CastSkill(skillID); }
private void Start() { ui = TipLoader.GetComponentInChildren <UITips>(); }
public static void ShowTips(string msg) { UITips uI = FindUI <UITips>() as UITips; uI.ShowTips(msg); }
//技能命中,获取被击的信息,发给被击对象做表现 public void OnSkillDamage(DamageParam damageParam) { if (ArenaMgr.Instance.IsArenaFight) { ArenaMgr.Instance.OnSkillDamage(damageParam); return; } //攻击者的信息 ActorObj attackActorObj = damageParam.attackActor; ActorObj behitActorObj = damageParam.behitActor; if (null == attackActorObj || null == behitActorObj) { return; } if (behitActorObj.IsDeath()) { return; } BehitParam behitParam = new BehitParam(); behitParam.displayType = DamageDisplayType.DDT_NORMAL; behitParam.hp = damageParam.Damage; #if !PUBLISH_RELEASE if (m_bMiaoGuai) { if (attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER) { behitParam.hp += 1000000; } } else { if (m_bWuShang && attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER) { behitParam.hp = 1; } } #endif //被击效果修正 behitParam.damgageInfo = damageParam; #if !PUBLISH_RELEASE if (m_bWuShang && behitActorObj.mActorType == ActorType.AT_LOCAL_PLAYER) { behitParam.hp = 1; } #endif //给技能释放者发送回复信息 // 发送被击消息给被击者 // if (behitParam.hp != 0) { behitActorObj.OnSkillBeHit(behitParam); } if (attackActorObj.mActorType == ActorType.AT_LOCAL_PLAYER) { behitActorObj.Health.ShowHPBar(5); } //受到其它玩家攻击时,提示开启善恶模式 if (behitParam.hp > 0 && behitActorObj.mActorType == ActorType.AT_LOCAL_PLAYER) { if (attackActorObj.mActorType == ActorType.AT_REMOTE_PLAYER) { if (PlayerData.Instance.CurPKMode == PKMode.PK_MODE_PEACE && (PlayerData.LastNoteSwitchPKTime <= 0 || (Time.realtimeSinceStartup - PlayerData.LastNoteSwitchPKTime) >= 60)) { bool autosetpk = false; if (autosetpk) { UITips.ShowTips("受到攻击,切换善恶模式"); PlayerData.Instance.SendSetPKRuleRequest(PKMode.PK_MODE_EVIL); } else { MainPanelMgr.Instance.ShowDialog("TipSwitchPKNote"); PlayerData.LastNoteSwitchPKTime = Time.realtimeSinceStartup; } } //没有目标则选中攻击者 ActorObj mainplayer = CoreEntry.gActorMgr.MainPlayer; if (mainplayer.m_SelectTargetObject == null) { mainplayer.SelectTarget(attackActorObj); } EventParameter ep = EventParameter.Get(); ep.objParameter = attackActorObj; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_PK_HURT, ep); } //玩家收到了攻击 AutoAIMgr automgr = CoreEntry.gAutoAIMgr; if (automgr.Config.AutoStrikeBack && TaskMgr.RunTaskType == 0 && !automgr.AutoFight && !behitActorObj.AutoPathFind) { float gap = Time.realtimeSinceStartup - automgr.LastOPTime; //LogMgr.Log("Last op gap {0}", gap); if (gap > automgr.Config.StrikeBackGapWithIdle) { automgr.AutoFight = true; } } } }
public void Update() { if (!bReconnect) { return; } // 连接上了 if (netClientThread != null && netClientThread.IsConnectted()) { bReconnect = false; Clear(); ReqReconnect(); return; } SpecialCondition(); //if (AutoReconnectCount > 0)//自动重连自次数内 //{ // if (ReconnectTime > ReconnectTimeGap)//超过单次重连时间 // { // ReconnectTime = 0; // AutoReconnectCount--; // if (AutoReconnectCount > 0) // { // LogMgr.UnityError(string.Format("auto reconnect time:{0}th", AutoReconnectCount)); // NetLogicGame.Instance.connectGame(netClientThread.m_serverIP, (short)netClientThread.m_serverPort); // } // } // else if (ReconnectTime == 0f) // { // LogMgr.UnityError(string.Format("auto reconnect time:{0}th", AutoReconnectCount)); // ReconnectTime = 0; // NetLogicGame.Instance.connectGame(netClientThread.m_serverIP, (short)netClientThread.m_serverPort); // } //} //else if (!IsShowReconnectedDialog) //{ // IsShowReconnectedDialog = true; // MainPanelMgr.Instance.HideDialog("UIWaitDialog"); // UITips.ShowTipsDialog("重新连接", "您已经掉线,是否重新连接?", "重新连接", onBtnReconnect, "返回登录", RequestToLogin); //} if (isLoadScene) { disconnectInLoad = true; } else if (!IsTipsDialogShow() && !NetLogicGame.Instance.IsCrossLinking) { if (needShowNotice) { IsShowReconnectedDialog = true; UITips.ShowTipSinginDlg("提示", "您已经断开连接,请重新登录", RequestToLogin); } else { RequestToLogin(); } } float deltaTime = Time.time - passTime; ReconnectTime += deltaTime; DisconnectionTime += deltaTime; PressButtonTime += deltaTime; passTime = Time.time; }
/// <summary> /// 获取37玩服务器列表 /// </summary> /// <returns></returns> private IEnumerator GetSQWServerList() { if (SQWSDK.isLogin) { int isfail = 0; //获取历史和推荐服务器 WWWForm form = new WWWForm(); form.AddField("userID", SQWSDK.Instance.userID); //token加密 string md5 = Md5Util.MD5Encrypt(SQWSDK.Instance.userID + "6842c6012614bd474f75d1067f3e805f"); form.AddField("token", md5); Debug.Log("发送参数:" + "userID: " + SQWSDK.Instance.userID + "key; " + "6842c6012614bd474f75d1067f3e805f"); Debug.Log("加密后:" + form.data.BytesToString()); form.AddField("package", Application.bundleIdentifier); Debug.Log("package:" + Application.bundleIdentifier); int sdkType = ClientSetting.Instance.GetIntValue("thirdPartyComponent"); int subChannel = ClientSetting.Instance.GetIntValue("SubChannel"); string strLoginListUrl = SDKMgr.Instance.GetDefaultServersURL(sdkType, subChannel); // WWW history = new WWW(strLoginListUrl, form); yield return(history); if (history.isDone) { SQWSDK.Instance.sdkDefalutList = history.text; Debug.Log("LoginListUrl:" + strLoginListUrl + " 推荐服务器列表:" + SQWSDK.Instance.sdkDefalutList); //获取公共服务器列表 WWWForm formServers = new WWWForm(); formServers.AddField("userID", SQWSDK.Instance.userID); formServers.AddField("package", Application.bundleIdentifier); formServers.AddField("version", ClientSetting.Instance.GetIntValue("PackageVersion")); string key = "7ada175d3828b656db7eda80dc7d58b3"; string token = Md5Util.MD5Encrypt(key + SQWSDK.Instance.userID + Application.bundleIdentifier + ClientSetting.Instance.GetIntValue("PackageVersion")); formServers.AddField("token", token); string strServerListUrl = SDKMgr.Instance.GetServersURL(sdkType, subChannel); Debug.Log("ServerListUrl:" + strServerListUrl + " 发送服务器列表参数:" + "userID: " + SQWSDK.Instance.userID + "package: " + Application.bundleIdentifier + "version: " + ClientSetting.Instance.GetIntValue("PackageVersion")); WWW ser = new WWW(strServerListUrl, formServers); yield return(ser); if (ser.isDone) { Debug.Log("服务器列表: " + ser.text); SQWSDK.Instance.sdkServerList = ser.text; } else if (!string.IsNullOrEmpty(ser.error)) { isfail = 1; Debug.Log("获取服务器列表失败:" + ser.error); } } else if (!string.IsNullOrEmpty(history.error)) { isfail = 1; Debug.Log("获取推荐服务器列表失败:" + history.error); } //根据状态发送消息 EventParameter ev = EventParameter.Get(); ev.intParameter = isfail;//获取状态 0成功 1失败 Debug.Log("服务器列表:" + isfail); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SQW_SERVERLIST, ev); if (1 == isfail) { UITips.ShowTips("重新刷新服务器列表"); StartCoroutine(GetSQWServerList()); } } }
// add game ui void InstantiateGameUI() { // gameMain GameObject gameUI = AddUIPrefab(GameMainPrefab, gameObject.transform); mUIGameMenuCtrl = gameUI.GetComponentsInChildren <UIGameMenuCtrl>(true)[0]; mUIGameMenuCtrl.Show(); mUIMainMidCtrl = gameUI.GetComponentsInChildren <UIMainMidCtrl>(true)[0]; mUIMainMidCtrl.Show(); mUIMinMapCtrl = gameUI.GetComponentsInChildren <UIMinMapCtrl>(true)[0]; mUIMinMapCtrl.Show(); mNPCTalk = gameUI.GetComponentsInChildren <UINPCTalk>(true)[0]; mNPCTalk.Hide(); mNPCSpeech = gameUI.GetComponentInChildren <UINpcSpeech>(); mServantTalk = gameUI.GetComponentsInChildren <UIServantTalk>(true)[0]; mServantTalk.Hide(); gameUI.SetActive(true); //UI System gameUI = AddUIPrefab(SytemPrefab, gameObject.transform); mSystemMenu = gameUI.GetComponentInChildren <UISystemMenu>(); mSystemMenu.e_OnShow += OnSystemWndShow; mSystemMenu.e_OnHide += OnSystemWndHide; mOption = gameUI.GetComponentInChildren <UIOption>(); mOption.e_OnShow += OnSystemWndShow; mOption.e_OnHide += OnSystemWndHide; mSaveLoad = gameUI.GetComponentInChildren <UISaveLoad>(); mSaveLoad.e_OnShow += OnSystemWndShow; mSaveLoad.e_OnHide += OnSystemWndHide; gameUI.SetActive(true); //Map gameUI = AddUIPrefab(worldMapPrefab, gameObject.transform); mUIWorldMap = gameUI.GetComponent <UIWorldMapCtrl>(); gameUI.SetActive(false); // UI Build gameUI = AddUIPrefab(buildPrefab, gameObject.transform); mBuildBlock = gameUI.GetComponent <UIBuildBlock>(); gameUI.SetActive(false); // Tip end gameUI = AddUIPrefab(tipsWmdPrefab, gameObject.transform); mTipsCtrl = gameUI.GetComponent <UITips>(); gameUI.SetActive(true); // TipRecords gameUI = AddUIPrefab(tipRecordsMgrPrefab, gameObject.transform); mTipRecordsMgr = gameUI.GetComponent <UITipRecordsMgr>(); gameUI.SetActive(false); //wnd // player info gameUI = AddUIPrefab(playerInfoPrefab, tsCenter); mUIPlayerInfoCtrl = gameUI.GetComponent <UIPlayerInfoCtrl>(); gameUI.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo; gameUI.SetActive(false); mUIPlayerInfoCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo; // Item Package gameUI = AddUIPrefab(ItemPackagePrefab, tsCenter); mItemPackageCtrl = gameUI.GetComponent <UIItemPackageCtrl>(); gameUI.SetActive(false); mItemPackageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_ItemPackge; // Npc Strage gameUI = AddUIPrefab(npcStoragePrefab, tsCenter); mNpcStrageCtrl = gameUI.GetComponent <UINpcStorageCtrl>(); gameUI.SetActive(false); mNpcStrageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_NpcStorage; // Compound Wnd gameUI = AddUIPrefab(compoundWndPrefab, tsCenter); mCompoundWndCtrl = gameUI.GetComponent <UICompoundWndControl>(); gameUI.SetActive(false); mCompoundWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Compound; // Servant Wnd gameUI = AddUIPrefab(servantWndPrefab, tsCenter); mServantWndCtrl = gameUI.GetComponent <UIServantWnd>(); gameUI.SetActive(false); mServantWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Servant; // Npc gameUI = AddUIPrefab(npcGuiPrefab, tsCenter); mNpcWnd = gameUI.GetComponent <UINpcWnd>(); gameUI.SetActive(false); mNpcWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Npc; // Mission Wnd gameUI = AddUIPrefab(missionWndPrefab, tsCenter); mUIMissionWndCtrl = gameUI.GetComponent <UIMissionWndCtrl>(); gameUI.SetActive(false); // MissionTrack Wnd gameUI = AddUIPrefab(missionTrackWndPrefab, tsCenterOther); mMissionTrackWnd = gameUI.GetComponent <UIMissionTrackCtrl>(); mMissionTrackWnd.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck; // mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0); mMissionTrackWnd.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0); gameUI.SetActive(false); // Get Item Wnd gameUI = AddUIPrefab(itemGetWndPrefab, tsCenter); mItemGet = gameUI.GetComponent <UIItemGet>(); gameUI.SetActive(false); // Item Option Wnd gameUI = AddUIPrefab(itemOpGuiPrefab, tsCenter); mItemOp = gameUI.GetComponent <UIItemOp>(); gameUI.SetActive(false); // Shop Wnd gameUI = AddUIPrefab(shopGuiPrefab, tsCenter); mShopWnd = gameUI.GetComponent <UIShopWnd>(); gameUI.SetActive(false); mShopWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Shop; // Item Box gameUI = AddUIPrefab(itemBoxGuiPrefab, tsCenter); mItemBox = gameUI.GetComponent <UIItemBox>(); gameUI.SetActive(false); // Repair Wnd gameUI = AddUIPrefab(repairWndGuiPrefab, tsCenter); mRepair = gameUI.GetComponent <UIRepairWnd>(); gameUI.SetActive(false); mRepair.transform.localPosition = UIDefaultPostion.Instance.pos_Repair; // Power Plant Solar Wnd gameUI = AddUIPrefab(powerPlantSolarPrefab, tsCenter); mPowerPlantSolar = gameUI.GetComponent <UIPowerPlantSolar>(); gameUI.SetActive(false); mPowerPlantSolar.transform.localPosition = UIDefaultPostion.Instance.pos_PowerPlant; // Revive Gui Wnd gameUI = AddUIPrefab(reviveGuiPrefab, tsCenter); mRevive = gameUI.GetComponent <UIRevive>(); gameUI.SetActive(false); // Ware House Wnd gameUI = AddUIPrefab(wareHouseGuiPrefab, tsCenter); mWarehouse = gameUI.GetComponent <UIWarehouse>(); gameUI.SetActive(false); mWarehouse.transform.localPosition = UIDefaultPostion.Instance.pos_WareHouse; //colony Wnd gameUI = AddUIPrefab(colonyWndPrefab, tsCenter); mCSUI_MainWndCtrl = gameUI.GetComponent <CSUI_MainWndCtrl>(); gameUI.SetActive(false); //phone Wnd gameUI = AddUIPrefab(phoneWndPrefab, tsCenter); mPhoneWnd = gameUI.GetComponent <UIPhoneWnd>(); gameUI.SetActive(false); // skill wnd gameUI = AddUIPrefab(skillWndPrefab, tsCenter); mSkillWndCtrl = gameUI.GetComponent <UISkillWndCtrl>(); gameUI.SetActive(false); // workshop wnd gameUI = AddUIPrefab(workshopPrefb, tsCenter); mWorkShopCtrl = gameUI.GetComponent <UIWorkShopCtrl>(); gameUI.SetActive(false); //information wnd gameUI = AddUIPrefab(informationPrefab, tsCenter); mTeamInfoMgr = gameUI.GetComponent <CSUI_TeamInfoMgr>(); gameUI.SetActive(false); // railwayPoint gameUI = AddUIPrefab(railwayPonitPrefab, tsCenter); mRailwayPoint = gameUI.GetComponent <RailwayPointGui_N>(); gameUI.SetActive(false); // mallWndPrefab if (Pathea.PeGameMgr.IsMulti) { gameUI = AddUIPrefab(mallWndPrefab, tsCenter); mMallWnd = gameUI.GetComponent <UIMallWnd>(); gameUI.SetActive(false); } //UI Adminstrator //AdminUI gameUI = AddUIPrefab(AdministratorPrefab, tsCenter); mAdminstratorWnd = gameUI.GetComponent <UIAdminstratorWnd>(); gameUI.SetActive(false); // Driving UI gameUI = AddUIPrefab(drivingPrefab, tsCenterOther); mDrivingCtrl = gameUI.GetComponent <UIDrivingCtrl>(); gameUI.SetActive(false); // Custom stopwatch UI gameUI = AddUIPrefab(stopwatchPrefab, transform); mStopwatchList = gameUI.GetComponent <UIStopwatchList>(); gameUI.SetActive(false); // Custom npc talk UI gameUI = AddUIPrefab(npcWndCustomPrefab, tsCenter); mNpcDialog = gameUI.GetComponent <UINpcDialog>(); // Custom npc mission ui gameUI = AddUIPrefab(missionWndCustomPrefab, tsCenter); mMissionGoal = gameUI.GetComponent <UIMissionGoal>(); // Custom MissionTrack ui gameUI = AddUIPrefab(missionTrackCustomPrefab, tsCenterOther); mCustomMissionTrack = gameUI.GetComponent <UIMissionTrack>(); mCustomMissionTrack.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck; // mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0); mCustomMissionTrack.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0); //lz-2016.10.22 KickstarterCtrl gameUI = AddUIPrefab(mKickstarterCtrlPrefab, tsCenter); mKickstarterCtrl = gameUI.GetComponent <KickstarterCtrl>(); gameUI.SetActive(false); //lz-2016.11.07 NpcTalkHistoryWnd gameUI = AddUIPrefab(mNpcTalkHistoryPrefab, tsCenter); mNpcTalkHistoryWnd = gameUI.GetComponent <NpcTalkHistoryWnd>(); gameUI.SetActive(false); // itemsTrack Wnd gameUI = AddUIPrefab(itemsTrackWndPrefab, tsCenterOther); mItemsTrackWnd = gameUI.GetComponent <UIItemsTrackCtrl>(); mItemsTrackWnd.transform.localPosition = mMissionTrackWnd.transform.localPosition + new Vector3(0, 170f, 0); gameUI.SetActive(false); }