Пример #1
0
        /// <summary>
        /// 暂停自动战斗
        /// </summary>
        public void PauseAutoFighting(bool isShowTips = false)
        {
            if (InstanceHelper.InstanceIsInPlay() == false)
            {
                return;
            }

            Actor localPlayer = Game.GetInstance().GetLocalPlayer();

            if (localPlayer == null)
            {
                return;
            }

            if (IsAutoFighting && localPlayer.GetAIEnable() == true)
            {
                localPlayer.ActiveAI(false);
                localPlayer.AttackCtrl.ClearCacheSkill();
                GameInput.Instance.EnableInput(true);
                mAutoFightBreakingTime = 0.0f;
                mAutoBreakRecoverTime  = GameConstHelper.GetFloat("GAME_AUTO_FIGHT_BREAK_RECOVER_TIME");

                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("AUTO_FIGHT_PAUSE"));
                }
            }
        }
Пример #2
0
        public bool CheckReply(string url, string error, System.Object replyObject)
        {
            if (string.IsNullOrEmpty(error) == false)
            {
                GameDebug.LogError("Control server error: " + error);
                xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("GET_SERVER_INFO_FAIL"));

                return(false);
            }

            Hashtable hashtable = replyObject as Hashtable;

            if (hashtable != null)
            {
                System.Object resultObject = hashtable["result"];
                if (resultObject != null)
                {
                    int result = System.Convert.ToInt32(resultObject);
                    if (result == 1)
                    {
                        return(true);
                    }
                    else if (result == 2)//result=2代表ticket过期
                    {
                        //登出游戏
                        IBridge bridge = DBOSManager.getDBOSManager().getBridge();
                        bridge.logout();
                        return(false);
                    }
                }
            }

            return(false);
        }
Пример #3
0
        public void Invite(List <uint> uuids)
        {
            if (mInviteAllCD == null)
            {
                C2STeamInvite data = new C2STeamInvite();
                foreach (uint uuid in uuids)
                {
                    if (GetInviteCD(uuid) == 0)
                    {
                        data.uuids.Add(uuid);
                    }
                }

                NetClient.BaseClient.SendData <C2STeamInvite>(NetMsg.MSG_TEAM_INVITE, data);

                mInviteAllCD = new Utils.Timer((int)mInviteInterval * 1000, false, 1000,
                                               (dt) =>
                {
                    if (dt <= 0f)
                    {
                        mInviteAllCD.Destroy();
                        mInviteAllCD = null;
                    }

                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INVITE_ALL_CD_CHANGED, null);
                });

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INVITE_ALL_CD_CHANGED, null);
            }
            else
            {
                UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_INVITE_IN_CD"), (int)(mInviteAllCD.Remain / 1000f)));
            }
        }
Пример #4
0
        /// <summary>
        /// 在进入副本之前检测副本是否下载完成
        /// 没下载的话会弹出提示框提示下载
        /// </summary>
        /// <param name="instance_id"></param>
        /// <returns></returns>
        public static bool PreCheckInstanceIsDownloaded(uint instance_id)
        {
            var instanceInfo = DBInstance.Instance.GetInstanceInfo(instance_id);

            if (instanceInfo == null)
            {
                return(false);
            }

            string asset_path;

            if (TryGetSceneResByInstanceInfo(instanceInfo, out asset_path))
            {
                int patch_id;
                if (!xpatch.XPatchManager.Instance.IsAssetDownloaded(asset_path, out patch_id))
                {
                    //需要下载最新资源才能体验当前内容
                    var content = DBConstText.GetText("DOWNLOAD_PATCH_TIPS");

                    UIWidgetHelp.Instance.ShowNoticeDlg(ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, content,
                                                        (param) => { ui.ugui.UIManager.Instance.ShowSysWindow("UIPatchWindow", patch_id); }, null);
                    return(false);
                }
            }

            return(true);
        }
Пример #5
0
        /// <summary>
        /// 删除好友
        /// </summary>
        /// <param name="id"></param>
        public void DeleteFriend(FriendType friendType, FriendsInfo friendInfo)
        {
            var data = new C2SRelationDel();

            if (friendInfo != null)
            {
                data.target_id = friendInfo.Uid;
                data.type      = (uint)friendType;
                string tips = string.Format(DBConstText.GetText("FRIENDS_DEL_1"), friendInfo.Name);
                if (friendType == FriendType.Friend)
                {
                    tips = string.Format(DBConstText.GetText("FRIENDS_DEL_FRIEND"), friendInfo.Name);
                }
                else if (friendType == FriendType.Black)
                {
                    tips = string.Format(DBConstText.GetText("FRIENDS_DEL_BLACKLIST"), friendInfo.Name);
                }

                ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, tips,
                                                            (dt) =>
                {
                    NetClient.GetBaseClient().SendData <C2SRelationDel>(NetMsg.MSG_RELATION_DEL, data);
                }
                                                            , null);
            }
        }
Пример #6
0
        protected void StopRecord(bool upload_file)
        {
            if (mState == State.Recording)
            {
                VoiceManager.Instance.StopRecord();
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_GVOICE_STOP_RECORD, new CEventBaseArgs());

                if (upload_file)
                {
                    if (mPressTime - DelayTime > RecordMinTime)
                    {
                        VoiceManager.Instance.UploadFile();
                    }
                    else
                    {
                        if (VoiceManager.Instance.IsCanSendByGameLogic)
                        {
                            // 录音时间太短
                            UINotice.Instance.ShowMessage(DBConstText.GetText("GAME_CHAT_RECORD_TIPS1"));
                        }
                    }
                }
            }

            mState = State.Idle;
        }
Пример #7
0
        public bool CheckServerState(ServerInfo serverInfo, bool isShowTips = true)
        {
            bool canEnter = true;

            if (serverInfo.State == EServerState.WillOpen)
            {
                canEnter = false;
                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(serverInfo.Desc);
                }
            }
            else if (serverInfo.State == EServerState.RoleIsFull)
            {
                canEnter = false;
                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("SERVER_CAN_NOT_LOGIN_TIPS"));
                }
            }
            else if (serverInfo.State == EServerState.Maintaining)
            {
                canEnter = false;
                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(serverInfo.Desc);
                }
            }

            return(canEnter);
        }
Пример #8
0
        public void HandleApply(uint choice, List <uint> uuids)
        {
            if (uuids == null || uuids.Count == 0)
            {
                return;
            }

            if (choice == 1)
            {
                if (IsFull == true || IsReachTargetMemberLimit == true)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_IS_FULL"));
                    return;
                }
            }

            C2STeamHandleApply data = new C2STeamHandleApply();

            data.choice = choice;
            data.uuids.AddRange(uuids);

            NetClient.BaseClient.SendData <C2STeamHandleApply>(NetMsg.MSG_TEAM_HANDLE_APPLY, data);

            foreach (uint uuid in uuids)
            {
                RemoveApplyInfo(uuid);
            }
            ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null);
        }
Пример #9
0
        public void LocalPlayerWalkToDestination(Vector3 targetPos, Task relateTask = null)
        {
            Actor player = Game.GetInstance().GetLocalPlayer();

            if (player == null)
            {
                return;
            }

            targetPos.y = RoleHelp.GetHeightInScene(player.ActorId, targetPos.x, targetPos.z);
            targetPos   = InstanceHelper.ClampInWalkableRange(targetPos, 10);

            // 判断是否可到达
            XNavMeshPath walkMeshPath = new XNavMeshPath();

            XNavMesh.CalculatePath(player.transform.position, targetPos, xc.Dungeon.LevelManager.GetInstance().AreaExclude, walkMeshPath);
            if (walkMeshPath.status != XNavMeshPathStatus.PathComplete)
            {
                // 如果通过任务导航寻路,且在新手副本的不可到达区域,则直接飞过去,以免因为配置错误而导致卡死
                if (relateTask != null && SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON"))
                {
                    GameDebug.LogWarning(DBConstText.GetText("MAP_POS_CAN_NOT_REACH") + ",该场景是新手场景,直接瞬移过去");
                    player.MoveCtrl.SendFly(targetPos);
                    player.SetPosition(targetPos);
                }
                else
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH"));
                }
                return;
            }

            InstanceManager.Instance.IsAutoFighting = false;

            mPathWalker.WalkTo(targetPos);
            //player.MoveCtrl.TryWalkTo(targetPos);

            /*
             * uint instanceType = InstanceManager.Instance.InstanceType;
             *
             * if (instanceType == GameConst.WAR_TYPE_WILD || instanceType == GameConst.WAR_TYPE_HOLE || instanceType == GameConst.WAR_SUBTYPE_WILD_PUB || instanceType == GameConst.WAR_TYPE_MULTI)
             * {
             *  if(mPathWalker == null)
             *  {
             *      return;
             *  }
             *
             *  mPathWalker.WalkTo(targetPos);
             * }
             * else
             * {
             *  player.MoveCtrl.TryWalkTo(targetPos);
             * }*/

            TaskNavigationActive(true);
            IsNavigating = true;
        }
Пример #10
0
 public ActorStateTransfering(uint id, Machine machine)
     : base(id, machine)
 {
     if (string.IsNullOrEmpty(mProgressBarName))
     {
         DBConstText db = DBManager.GetInstance().GetDB <DBConstText>();
         mProgressBarName = string.Format("{0}{1}", db.Text("TRANSFER"), db.Text("ING"));
     }
 }
Пример #11
0
        static void TryInitTimeFormat()
        {
            m_time_format_houras_hours   = DBConstText.GetText("TIME_FORMAT_HAS_HOURS");
            m_time_format_houras_minutes = DBConstText.GetText("TIME_FORMAT_HAS_MINUTES");
            m_time_format_houras_seconds = DBConstText.GetText("TIME_FORMAT_HAS_SECONDS");

            m_time_format_hour = DBConstText.GetText("TIME_FORMAT_HOUR"); //时
            m_time_format_min  = DBConstText.GetText("TIME_FORMAT_MIN");  //分
            m_time_format_sec  = DBConstText.GetText("TIME_FORMAT_SEC");  //秒
        }
Пример #12
0
        public static string GetFlyWordById(uint id)
        {
            var    db  = DBManager.Instance.GetDB <DBFlyWord>();
            string key = db.GetFlyWordKey(id);

            if (key != null)
            {
                return(DBConstText.GetText(key));
            }
            return("");
        }
Пример #13
0
        /// <summary>
        /// 通过查副本切换控制表来检查能否切换
        /// </summary>
        /// <param name="warType"></param>
        /// <param name="warSubType"></param>
        /// <returns></returns>
        public static bool CheckCanSwitch(uint warType, uint warSubType, bool show_notice = true)
        {
            uint curWarType    = InstanceManager.Instance.InstanceType;
            uint curWarSubType = InstanceManager.Instance.InstanceSubType;

            // 游戏初始副本类型的值都是0,这时候可以跳转到任何副本
            if (curWarType == 0 && curWarSubType == 0)
            {
                return(true);
            }

            List <string> datas = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "instance_switch_control", "id", curWarType + "_" + curWarSubType, "type_" + warType + "_" + warSubType);

            if (datas != null && datas.Count > 0)
            {
                uint val = 0;
                uint.TryParse(datas[0], out val);
                if (val > 0)
                {
                    return(true);
                }
            }
            else
            {
                GameDebug.LogError("Check can switch instance error, can not find config in excel, current war type: " + curWarType + ", current war sub type: " + curWarSubType + ", target war type: " + warType + ", target war sub type: " + warSubType);
                return(false);
            }

            bool isInstance = false;

            if (warType == GameConst.WAR_TYPE_DUNGEON)
            {
                isInstance = true;
            }

            if (isInstance == true)
            {
                if (show_notice)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_SWITCH_INSTANCE"));
                }
            }
            else
            {
                if (show_notice)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_SWITCH_WILD_INSTANCE"));
                }
            }

            GameDebug.Log("Can not switch instance, current war type: " + curWarType + ", current war sub type: " + curWarSubType + ", target war type: " + warType + ", target war sub type: " + warSubType);

            return(false);
        }
Пример #14
0
        /// <summary>
        /// 同意好友申请
        /// </summary>
        /// <param name="uuid"></param>
        public void ApproveApplicant(uint uuid)
        {
            if (FriendsManager.Instance.IsBlackList(uuid))
            {
                UINotice.Instance.ShowMessage(DBConstText.GetText("GAME_PLAYER_IN_BLACKLIST_TIPS"));
                return;
            }
            var pack = new C2SRelationFriendApprove();

            pack.uuid = uuid;
            NetClient.GetBaseClient().SendData <C2SRelationFriendApprove>(NetMsg.MSG_RELATION_FRIEND_APPROVE, pack);
        }
Пример #15
0
 /// <summary>
 /// 是否可以跳转到其他副本去
 /// </summary>
 /// <returns></returns>
 public bool TryToOtherDungeonScene()
 {
     if (SceneHelp.IsReEnterScene)//处于重进当前场景中,一直允许切换
     {
         return(true);
     }
     if (PKModeManagerEx.Instance.IsInPVPState() || PKModeManagerEx.Instance.IsPVPBattleState)
     {
         xc.UINotice.Instance.ShowMessage(DBConstText.GetText("SKILL_CANNT_FLY_IN_PVP_BATTLE"));
         return(false);
     }
     return(true);
 }
Пример #16
0
        public static string GetConstText(string key)
        {
            DBConstText dbText = DBManager.Instance.GetDB <DBConstText>();

            if (dbText != null)
            {
                var res = dbText.Text(key);

                res = res.Replace("\\n", "\n");
                return(res);
            }

            return(string.Empty);
        }
Пример #17
0
        public bool CheckSysDownloaded(uint sys_id)
        {
            int patch_id;

            if (!SysConfigManager.Instance.CheckSysHasDownloaded(sys_id, out patch_id))
            {
                //需要下载最新资源才能体验当前内容
                var content = DBConstText.GetText("DOWNLOAD_PATCH_TIPS");
                ui.UIWidgetHelp.Instance.ShowNoticeDlg(ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, content,
                                                       (param) => { ui.ugui.UIManager.Instance.ShowSysWindow("UIPatchWindow", patch_id); }, null);
                return(false);
            }

            return(true);
        }
Пример #18
0
        public bool Apply(uint teamId)
        {
            if (HaveTeam == true)
            {
                UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_HAVE_TEAM_CAN_NOT_APPLY"));
                return(false);
            }

            C2STeamApply data = new C2STeamApply();

            data.team_id = teamId;

            NetClient.BaseClient.SendData <C2STeamApply>(NetMsg.MSG_TEAM_APPLY, data);

            return(true);
        }
Пример #19
0
        /// <summary>
        /// 判断是否满足组件的条件(图片名称,文本内容)
        /// </summary>
        /// <param name="widget"></param>
        /// <returns></returns>
        public bool MatchComponent(GameObject widget, string path)
        {
            var pathParams = path.Split(new char[] { ':' });

            if (pathParams.Length <= 2) //没有组件条件,当做满足处理
            {
                return(true);
            }
            if (pathParams.Length <= 3) //配置格式错误
            {
                return(false);
            }

            var componentType  = pathParams[2];
            var componentValue = pathParams[3];

            if (componentType == "Image")
            {
                Image image = widget.GetComponent <Image>();
                return(image != null && image.sprite.name == componentValue);
            }
            else if (componentType == "Text")
            {
                Text text = widget.GetComponent <Text>();
                return(text != null && text.text == DBConstText.GetText(componentValue));
            }
            else if (componentType == "GoodsNameText")
            {
                Text text = widget.GetComponent <Text>();
                uint goodsId;
                if (!uint.TryParse(componentValue, out goodsId))
                {
                    return(false);
                }
                return(text != null && text.text == GoodsHelper.GetGoodsOriginalNameByTypeId(goodsId));
            }
            if (componentType == "RawImage")
            {
                RawImage rawImage = widget.GetComponent <RawImage>();
                return(rawImage != null && rawImage.mainTexture.name == componentValue);
            }
            else
            {
                return(false);
            }
        }
Пример #20
0
        public void OnGetPackFinished(string url, string error, string reply, System.Object userData)
        {
            if (string.IsNullOrEmpty(error) == false)
            {
                GameDebug.LogError("OnGetPackFinished error: " + error);
                UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_FAIL"));

                mPostGetPackFinishedCallback?.Invoke(false);
                return;
            }

            bool      ret       = false;
            Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable;

            if (hashtable != null)
            {
                int result = DBTextResource.ParseI(hashtable["result"].ToString());
                if (result == 1)
                {
                    UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_EXCHANGE_SUCCESS"));

                    ret = true;
                }
                else
                {
                    Hashtable argsHashtable = hashtable["args"] as Hashtable;
                    if (argsHashtable != null)
                    {
                        string msg           = argsHashtable["error_msg"].ToString();
                        string translatedMsg = xc.TextHelper.GetTranslateText(msg);
                        UINotice.GetInstance().ShowMessage(translatedMsg);
                    }
                    else
                    {
                        UINotice.GetInstance().ShowMessage(DBConstText.GetText("GIFT_BAG_FAIL"));
                    }
                }
            }
            else
            {
                GameDebug.LogError("OnGetPackFinished error: " + reply);
            }

            mPostGetPackFinishedCallback?.Invoke(ret);
        }
Пример #21
0
        public void SystemMessageEx(string param)
        {
            /*{
             *  "action":"PayCallback",
             *  "code":1,  // 1:成功 -1:取消
             *  "msg":"支付成功"
             *
             * }*/

            var json_object = MiniJSON.JsonDecode(param);

            if (json_object == null)
            {
                Debug.LogError("SystemMessageEx: json is invalid");
                return;
            }

            Hashtable param_info = json_object as Hashtable;

            if (param_info == null)
            {
                Debug.LogError("SystemMessageEx: param_info is invalid");
                return;
            }

            string action = param_info["action"].ToString();

            if (action == "PayCallback") // 支付的回调
            {
                int    code = int.Parse(param_info["code"].ToString());
                string msg  = param_info["msg"].ToString();
                if (code == 1)// 成功或者取消的时候才提示
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_SUCC"));
                }
                else if (code == -1)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_CANCEL"));
                }
                else
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("PAY_NOTICE_FAIL"));
                }
            }
        }
Пример #22
0
        /// <summary>
        /// 能否进入结婚场景
        /// </summary>
        public static bool CanJumpToMarryScene(bool needTips)
        {
            List <uint> npcParams = xc.GameConstHelper.GetUintList("GAME_MARRY_NPC");
            uint        id        = npcParams[0];
            var         attr      = LocalPlayerManager.Instance.LocalActorAttribute;
            var         needLv    = InstanceHelper.GetInstanceNeedRoleLevel(id);

            if (attr != null && attr.Level < needLv)
            {
                if (needTips)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("MARRIAGE_LEVEL_NOT_ENOUGH"), needLv));
                    //UINotice.Instance.ShowMessage(string.Format("情缘岛地图{0}级开放,等级不足无法进入", needLv));
                }
                return(false);
            }
            return(true);
        }
Пример #23
0
        /// <summary>
        /// 发送申请好友请求
        /// </summary>
        /// <param name="id"></param>
        public void SendAddFriendRequest(FriendType type, uint id, uint targetLv = 0)
        {
            if (targetLv > 0)
            {
                uint limit = GameConstHelper.GetUint("GAME_FRIEND_LV_LIMIT");
                if (targetLv < limit)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("FRIENDS_ADD_OTHER_LEVEL_NOT_ENOUGH"), limit));
                    return;
                }
            }
            var data = new C2SRelationAdd();

            data.type      = (uint)type;
            data.target_id = id;
            NetClient.GetBaseClient().SendData <C2SRelationAdd>(NetMsg.MSG_RELATION_ADD, data);
            //if (type == FriendType.Friend)
            //    UINotice.Instance.ShowMessage(DBConstText.GetText("HAS_SENT_FRIEND_APPLICATION"));
        }
Пример #24
0
 public bool GotoSoulTownWnd(params object[] args)
 {
     if (!SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_SOUL_TOWN, true))
     {
         return(false);
     }
     if (!CheckSysDownloaded(GameConst.SYS_OPEN_SOUL_TOWN))
     {
         return(false);
     }
     if (SceneHelp.Instance.IsKungfuInstance == false)
     {
         UIManager.Instance.ShowSysWindow("UIKungfuGodWindow");
     }
     else
     {
         xc.UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_ALREADY_IN_IT"));
     }
     return(true);
 }
Пример #25
0
        public bool Invite(uint uuid)
        {
            uint cd = GetInviteCD(uuid);

            if (cd == 0)
            {
                C2STeamInvite data = new C2STeamInvite();
                data.uuids.Add(uuid);

                NetClient.BaseClient.SendData <C2STeamInvite>(NetMsg.MSG_TEAM_INVITE, data);

                return(true);
            }
            else
            {
                UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_INVITE_IN_CD"), cd));

                return(false);
            }
        }
Пример #26
0
        /// <summary>
        /// 获取指定技能槽未开启时候的提示文本
        /// </summary>
        /// <param name="vocationId"></param>
        /// <param name="slotPos"></param>
        /// <returns></returns>
        public string GetSkillSlotNotice(uint vocationId, uint slotPos)
        {
            VocationSkillSlotInfo info;

            mInfos.TryGetValue(vocationId, out info);
            if (info != null)
            {
                var slotInfo = info.GetSlotInfo(slotPos);
                if (slotInfo != null)
                {
                    var textKey = slotInfo.NotOpenNotice;
                    if (!string.IsNullOrEmpty(textKey))
                    {
                        var notice = DBConstText.GetText(textKey);
                        return(notice);
                    }
                }
            }

            return("");
        }
Пример #27
0
        public void AddBlackList(uint uuid)
        {
            FriendsInfo        black      = null;
            List <FriendsInfo> friendList = null;

            if (mCommon.TryGetValue(FriendType.Black, out friendList) == true)
            {
                black = friendList.Find(delegate(FriendsInfo _info)
                {
                    return(_info.Uid == uuid);
                });
                if (black != null)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("FRIENDS_ADD_1"));
                }
                else
                {
                    if (uuid == LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx)
                    {
                        UINotice.Instance.ShowMessage(DBConstText.GetText("FRIENDS_ADD_2"));
                        return;
                    }
                    ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, DBConstText.GetText("FRIENDS_ADD_8"),
                                                                (dt) =>
                    {
                        FriendsNet.Instance.SendAddFriendRequest(FriendType.Black, uuid);
                    }
                                                                , null);
                }
            }
            else
            {
                ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, DBConstText.GetText("FRIENDS_ADD_8"),
                                                            (dt) =>
                {
                    FriendsNet.Instance.SendAddFriendRequest(FriendType.Black, uuid);
                }
                                                            , null);
            }
        }
Пример #28
0
        public void OnGetServerListFinished(string url, string error, string reply, System.Object userData)
        {
            System.Object replyObject = MiniJSON.JsonDecode(reply);
            if (string.IsNullOrEmpty(error) == false)
            {
                GameDebug.LogError("Control server error: " + error);
                xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("GET_SERVER_INFO_FAIL"));

                if (mGetServerListFinishedCallback != null)
                {
                    mGetServerListFinishedCallback(null);
                }

                return;
            }

            List <ServerInfo> serverList = ParseServerList((replyObject as Hashtable)["args"]);

            if (mGetServerListFinishedCallback != null)
            {
                mGetServerListFinishedCallback(serverList);
            }
        }
Пример #29
0
        // 大于1小时->小时xx分
        // 小于1小时->xx分xx秒
        public static string SecondsToStr_4(int total_seconds)
        {
            if (total_seconds < 0)
            {
                total_seconds = 0;
            }

            int hour = total_seconds / 3600;
            int min  = (total_seconds - hour * 3600) / 60;
            int sec  = total_seconds % 60;

            string ret = "";

            if (hour > 0)
            {
                ret = string.Format(DBConstText.GetText("OFFLINE_TIME_FORMAT_HAS_HOURS"), hour, min);
            }
            else
            {
                ret = string.Format(DBConstText.GetText("TIME_FORMAT_HAS_MINUTES"), min, sec);
            }
            return(ret);
        }
Пример #30
0
        /// <summary>
        /// 触发技能
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        bool TrggerSkill(uint skill_id)
        {
            LocalPlayer localPlayer = Game.GetInstance().GetLocalPlayer() as LocalPlayer;

            if (localPlayer == null)
            {
                return(false);
            }

            if (!localPlayer.IsResLoaded)
            {
                return(false);
            }

            Skill skill = localPlayer.GetSelfSkill(skill_id);

            if (skill == null)
            {
                return(false);
            }

            if (localPlayer.AttackCtrl.IsSkillCanCast_showTipsWhenFalse(skill, 0, ref m_tips_type) == false)
            {
                if (m_tips_type != ClickRockButtonTipsType.None)
                {
                    Dictionary <ClickRockButtonTipsType, float> m_tipsData;
                    if (m_clickRockButtonTips.TryGetValue(skill_id, out m_tipsData) == false)
                    {
                        m_clickRockButtonTips[skill_id] = new Dictionary <ClickRockButtonTipsType, float>();
                        m_tipsData = m_clickRockButtonTips[skill_id];
                    }
                    if (m_tipsData.ContainsKey(m_tips_type) == false)
                    {
                        m_tipsData[m_tips_type] = 0;
                    }
                    if (Time.realtimeSinceStartup >= m_tipsData[m_tips_type] + m_rockButtonTipsInterval)
                    {
                        m_tipsData[m_tips_type] = Time.realtimeSinceStartup;
                        if (m_tips_type == ClickRockButtonTipsType.IsInCD)
                        {
                            UINotice.GetInstance().ShowMessage(DBConstText.GetText("SKILL_IN_CD"));
                        }
                        else if (m_tips_type == ClickRockButtonTipsType.NotEnoughMp)
                        {
                            UINotice.GetInstance().ShowMessage(DBConstText.GetText("MP_NOT_ENOUGH"));
                        }
                    }
                }

                return(false);
            }

            bool needAi = false;

            if (skill.GetAction(0).ActionData.SkillInfo.Target == "rival")
            {
                needAi = true;
                //InstanceManager.Instance.IsInAutoFireOneSkillModel = true;
            }

            bool attack_succ = false;

            if (localPlayer.IsGrounded())
            {
                attack_succ = localPlayer.AttackCtrl.Attack(skill.SkillData.SkillID);

                localPlayer.MoveCtrl.Interrupt();
            }

            return(attack_succ);
        }