public void Set(uint id, uint num) { mId = id; DBInstance.InstanceInfo info = DBManager.Instance.GetDB <DBInstance>().GetInstanceInfo(id); if (id == GameConstHelper.GetUint("GAME_WILD_DUNGEON_PRIMARY_ID")) { labelName.text = info.mName + string.Format(DBConstText.GetText("PRIMARY_TITLE_SUFFIX"), GameConstHelper.GetUint("GAME_WILD_PRIMARY_BATTLE_POWER")); } else { labelName.text = info.mName; } UIWIldSwitchLine.SetAmount(spriteProgress, num); if (WildManager.Instance.mCurrentLineId == id) { goHead.SetActive(true); RoleHelp.GetIconName(Game.GetInstance().LocalPlayerTypeID, texHead); goButton.SetActive(false); } else { goHead.SetActive(false); goButton.SetActive(true); if (id == WildManager.Instance.mCurrentWaitingLineId) { lableButton.text = xc.DBConstText.GetText("IN_QUEUE"); } else { lableButton.text = xc.DBConstText.GetText("GOTO"); } } }
/// <summary> /// 判断帮派篝火能否烤肉 /// </summary> public bool GuildBonfireCheckCanMeat(bool showTips) { uint num = 0; object[] param = { }; System.Type[] returnType = { typeof(uint) }; object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GuildBonfireDataManager_GetMeatNum", param, returnType); if (objs != null && objs.Length > 0) { if (objs[0] != null) { num = (uint)objs[0]; } } uint maxNum = GameConstHelper.GetUint("GAME_GUILD_FIRE_MAX_MEAT_NUM"); bool ret = false; if (num < maxNum) { ret = true; } else { if (showTips == true) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("GUILD_FIRE_GET_MEAT_REACH_MAX"), maxNum)); } } return(ret); }
public void Awake() { mTrans = transform; mRectTrans = GetComponent <RectTransform>(); // 通过配置获取可显示的最大buff数量 mBuffMaxCount = GameConstHelper.GetInt("GAME_BUFF_MAX_COUNT"); if (mBuffMaxCount == 0) { mBuffMaxCount = 5; } mBuffWidgets = new BuffWidget[mBuffMaxCount]; // 获取所有buff显示的控件 for (int i = 0; i < mBuffMaxCount; ++i) { Transform trans = mTrans.Find(string.Format("Buff{0}", i)); var buffWidget = new BuffWidget(); buffWidget.WidgetObject = trans.gameObject; buffWidget.BuffImage = trans.Find("BuffTex").GetComponent <RawImage>(); mBuffWidgets[i] = buffWidget; } mBuffIds = new List <uint>(); }
protected override string GetBehaivorTreeFile() { if (!string.IsNullOrEmpty(mExclusiveAIFile)) { return(mExclusiveAIFile); } if (InstanceManager.Instance.IsPlayerVSPlayerType) { return(@"AI/gvg_robot.json"); } if (SceneHelp.Instance.IsInInstance) { // 副本里面活动半径是无限大 mRunningProperty.MotionRadius = 999999f; //return @"AI/player_instance.json"; } else { mRunningProperty.MotionRadius = GameConstHelper.GetFloat("GAME_AUTO_FIGHT_MOTION_RADIUS"); } // 定点挂机 //if (HookSettingManager.Instance.RangeType == EHookRangeType.FixedPos) //{ // mRunningProperty.MotionRadius = 0f; //} return(@"AI/player.json"); }
public override void Awake() { base.Awake(); DrawFPS = false; var const_float_val = GameConstHelper.GetFloat("FPS_WAIT_TIME"); // fps检测的间隔时间 if (const_float_val != 0) { FPSUpdateWaitTime = const_float_val; } var const_int_val = GameConstHelper.GetInt("FPS_MIN_LIMIT"); if (const_int_val != 0) { mFpsMinLimit = const_int_val; } const_int_val = GameConstHelper.GetInt("FPS_NOTICE_INTERVALTIME"); if (const_int_val != 0) { mFpsNoticeIntervalTime = const_int_val; } }
private void Awake() { // TODO C# UIMainmapWindow 接口不可用,需要改成新的控制方式 //UIMainmapWindow uiMainMap = UIManager.Instance.GetWindowImm<UIMainmapWindow>(); //Transform anchorTarget = uiMainMap.FindChild("MinimapBgSprite").transform; // UIWidget widget = goUnfold.GetComponent<UIWidget>(); // widget.leftAnchor.target = anchorTarget; // widget.rightAnchor.target = anchorTarget; // widget.bottomAnchor.target = anchorTarget; // widget.topAnchor.target = anchorTarget; // widget.ResetAndUpdateAnchors(); instance = this; OnUnFold(); OnAmountChanged(null); goSwitchBoard.SetActive(false); string[] splits = GameConstHelper.GetString("GAME_MWAR_WILD_HUMAN_COLOUR").Split(',', '[', ']'); int index = 0; foreach (var item in splits) { float f = 0; if (index < mPercent.Length && float.TryParse(item, out f)) { mPercent[index] = f; ++index; } } }
public void RefreshSwtichBoard() { //set items mPrimary = null; int i = 0; foreach (var item in WildManager.Instance.mLineAmout) { if (i >= items.Length) { break; } items[i].Set(item.Key, item.Value); items[i].gameObject.SetActive(true); if (item.Key == GameConstHelper.GetUint("GAME_WILD_DUNGEON_PRIMARY_ID")) { mPrimary = items[i]; } ++i; } for (int j = i; j < items.Length; j++) { items[j].gameObject.SetActive(false); } UIWildSwtichLineItem waitingItem = getItem(WildManager.Instance.mCurrentWaitingLineId); if (waitingItem != null) { labelWaitingNumTip.text = string.Format(xc.DBConstText.GetText("SWITCH_LINE_WAITING_TIP"), waitingItem.labelName.text, WildManager.Instance.mWaitingNum); } labelWaitingNumTip.gameObject.SetActive(waitingItem != null); }
protected override void InitUI() { foreach (var item in m_fightEffectItemArray) { item.Value.m_obj = FindChild(item.Value.m_name); if (item.Value.m_obj != null) { item.Value.m_obj.SetActive(false); } } m_showAddBuffTipsInterval = GameConstHelper.GetFloat("GAME_BF_SHOW_ADD_BUFF_TIPS_INTERVAL"); mFightingTipRoot = FindChild("FightingTipRoot"); mFightingTipRoot.SetActive(true); mFightingTipContainer = FindChild(mFightingTipRoot, "Container"); mFightingTipItem = FindChild(mFightingTipRoot, "ItemTemplate"); mFightingTipItem.SetActive(false); mLayoutLevelList = new List <GameObject>(); for (int i = 0; i < 5; i++) { var layoutLevel = FindChild(string.Format("LayoutLevel_{0}", i)); mLayoutLevelList.Add(layoutLevel); } InitFightTipPanel(); base.InitUI(); }
public static bool IsIndependentSysWindow(string windowName) { if (sIndependentSysWindows == null) { sIndependentSysWindows = GameConstHelper.GetStringList("GAME_INDEPENDENT_SYS_WINDOWS"); } return(sIndependentSysWindows.Contains(windowName)); }
/// <summary> /// 根据属性列表算出战力 /// </summary> /// <returns></returns> public static ulong CalBattlePowerByAttrs(ActorAttribute attr) { if (attr == null) { return(0); } float baseValue = 0; float additionValue = 0; float specialValue = 0; float fourValue = 0; foreach (KeyValuePair <uint, IActorAttribute> kv in attr) { uint attrId = kv.Value.Id; BattlePowerInfo battlePowerInfo = DBBattlePower.Instance.GetBattlePowerInfo(attrId); if (battlePowerInfo != null) { long attrVal = kv.Value.Value; uint battleType = battlePowerInfo.val.Key; float battleValue = battlePowerInfo.val.Value; switch (battleType) { case 1: // 基数 { baseValue += attrVal * battleValue; } break; case 2: // 加成 { additionValue += attrVal * battleValue; } break; case 3: // 特殊 { float specialAttr = (GameConstHelper.GetFloat("GAME_CF_SPEED1") * attrVal) / (GameConstHelper.GetFloat("GAME_CF_SPEED2") + attrVal) - GameConstHelper.GetFloat("GAME_CF_SPEED3"); specialValue += specialAttr * battleValue; } break; case 4: // 一比一加战力 { fourValue += attrVal * battleValue; } break; default: break; } } } return((ulong)(baseValue * (10000.0f + additionValue + specialValue) / 10000.0f + fourValue)); }
void OnTimeLineFinish(CEventBaseArgs data) { uint timelineId = (uint)data.arg; List <uint> ids = GameConstHelper.GetUintList("GAME_PICK_BOSS_CLIP_TIMELINE_ID"); if (ids.Contains(timelineId)) { FinishPickImmediately(); } }
private uint GetCurrentBuyNumber() { uint result = 0; uint.TryParse(mBuyNumberInput.value, out result); if (result > GameConstHelper.GetUint("meConst.GAME_SHOP_MAX_BUY_NUMBER")) { result = GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER"); mBuyNumberInput.value = result.ToString(); } return(result); }
private float mResetInterval = 5; //自动重置列表目标的时长(秒) public override void Enter(params object[] param) { inst = this; mCurShowObjIdx = 0; mDataArray.Clear(); mNoAttackInterval = GameConstHelper.GetFloat("GAME_BATTLE_HOSTILE_NO_ATTACK_TIME"); mResetInterval = GameConstHelper.GetFloat("GAME_BATTLE_HOSTILE_RESET_TIME"); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.EC_ACTOR_ADD_UNDER_ATTACK, OnAddUnderAttackActor); if (mTimer != null) { mTimer.Destroy(); mTimer = null; } }
protected override void ResetUI() { base.ResetUI(); if (mCountDownTimer != null) { mCountDownTimer.Destroy(); } mTimeout = GameConstHelper.GetUint("GAME_OFFLINE_TIMEOUT"); mTimeText.text = string.Format("{0}", mTimeout); // 初始化倒计时的显示 mStartTime = Time.unscaledTime; mCountDownTimer = new Utils.Timer(mTimeout * 1000, false, 1000, OnTimeUpddate); Game.Instance.ManualCancelReconnect = false; }
/// <summary> /// 加载指引需要的角色模型 /// </summary> public void PrepareModel(string ani_name) { m_AnimationName = ani_name; if (m_ModelId != null) { var actor = ActorManager.Instance.GetActor(m_ModelId); if (actor != null && string.IsNullOrEmpty(ani_name) == false) { actor.CrossFade(ani_name); float delay_time = actor.GetAnimationLength(m_AnimationName); MainGame.HeartBehavior.StartCoroutine(PlayIdle(actor, delay_time, "idle")); } } else { m_ModelId = ClientModel.CreateClientModelByActorIdForLua(GameConstHelper.GetUint("GAME_GUIDE_MODEL"), OnModelLoaded); } }
/// <summary> /// 初始化角色职业id等信息 /// </summary> private void SetData() { var role_ids = GameConstHelper.GetUintList("GAME_AVAILABLE_ROLE_ID"); mActorNum = role_ids.Count; mRoleData = new List <PkgPlayerBrief>(); for (int i = 0; i < mActorNum; ++i) { PkgPlayerBrief roleBrief = new PkgPlayerBrief(); roleBrief.rid = role_ids[i]; roleBrief.uuid = 0; roleBrief.name = new byte[0]; roleBrief.level = 0; mRoleData.Add(roleBrief); } }
public override void Enter(params object[] param) { Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_NWAR_DROP, HandleServerData); Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_NWAR_PICK, HandleServerData); Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_NWAR_PICK_FAIL, HandleServerData); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_MONSTERDEAD, OnMonsterDead); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_PICK_DROP, OnPickDrop); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_DESTROY_DROP, OnDestroyDrop); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SHOW_PICK_DROP_FLOAT_TIPS, OnShowPickDropFloatTips); mTimerList = new List <Utils.Timer>(); mTimerList.Clear(); mLoadDropPrefabCoroutine = new List <Coroutine>(); mLoadDropPrefabCoroutine.Clear(); mFloatTipsCD = GameConstHelper.GetFloat("GAME_MWAR_DROP_FLOAT_TIPS_CD"); }
private void OnMaxButtonClicked() { if (mCurrentCommodity == null) { return; } uint money = LocalPlayerManager.Instance.GetMoneyByConst((ushort)mCurrentCommodity.PriceType); uint num = money / mCurrentCommodity.Price; if (num < 1) { num = 1; } if (num > GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER")) { num = GameConstHelper.GetUint("GAME_SHOP_MAX_BUY_NUMBER"); } mBuyNumberInput.value = num.ToString(); }
public static void SetAmount(UISprite sprite, uint num) { float percent = Mathf.Max((float)num / GameConstHelper.GetFloat("GAME_MWAR_WILD_MAX_HUMAN"), 0.2f); if (percent < 0.7f) { percent += 0.1f; } if (percent <= mPercent[0]) { sprite.spriteName = SPRITE_BAR_GREEN; } else if (num <= mPercent[1]) { sprite.spriteName = SPRITE_BAR_YELLOW; } else { sprite.spriteName = SPRITE_BAR_RED; } sprite.fillAmount = percent; }
protected override void InitCtrl() { base.InitCtrl(); m_PrepearAutoSelectInterval = GameConstHelper.GetFloat("GAME_BF_PREPEAR_AUTO_SELECT_INTERVAL"); m_PrepearAutoSelectSearchRadius = GameConstHelper.GetFloat("GAME_BF_PREPEAR_AUTO_SELECT_SEARCH_RADIUS"); m_PrepearAutoSelectMoveMaxDist = GameConstHelper.GetFloat("GAME_BF_PREPEAR_AUTO_SELECT_MOVE_MAX_DIST"); mVisibleCtrl.SetActorVisible(true, VisiblePriority.NORMAL); // attackctrl AttackCtrl.mIsSendMsg = true; AttackCtrl.mIsRecvMsg = false; AttackCtrl.mIsProcessInput = true; // beattackctrl BeattackedCtrl.mIsSendMsg = true; BeattackedCtrl.mIsRecvMsg = true; // movectrl MoveCtrl.mIsProcessInput = true; MoveCtrl.mIsRecvMsg = false; MoveCtrl.mIsSendMsg = true; }
void OnClickCreateNewRoleButton() { string char_name = mNameInputField.text; // 判断是否输入了角色名 if (char_name.Length <= 0) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL1")); //请输入角色名 return; } // 韩国版的角色名字和聊天敏感字库读取不同的表,其他 if (Const.Region == RegionType.KOREA) { // 判断角色名字是否合法 if (SensitiveWordsFilterPlayerName.Instance.IsInputUserNameLegal(char_name) == false) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL2")); //角色名请使用汉字,英文或者数字 return; } // 判断角色名中的敏感字符 if (SensitiveWordsFilterPlayerName.GetInstance().IsHaveSensitiveWords(char_name)) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL3"));//角色名中包含敏感字符 return; } } else { // 判断角色名字是否合法 if (SensitiveWordsFilter.Instance.IsInputUserNameLegal(char_name, Const.Region) == false) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL2")); //角色名请使用汉字,英文或者数字 return; } // 判断角色名中的敏感字符 if (SensitiveWordsFilter.GetInstance().IsHaveSensitiveWords(char_name)) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL3"));//角色名中包含敏感字符 return; } } // 判断角色名字是否超长 var utf8_parse = new Utf8Parse(char_name); float role_name_len = utf8_parse.GetWordLenByRule(); if (role_name_len > (float)GameConstHelper.GetFloat("GAME_NAME_MAX_COUNT")) { UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("NAME_COUNT_EXCEED")); GameDebug.Log("role_name_len:" + role_name_len); return; } if (GlobalConfig.GetInstance().LoginInfo == null || GlobalConfig.GetInstance().LoginInfo.ServerInfo == null) { return; } mVocationId = 4; // 发送创建角色的协议 var create_role = new C2SCreateRole(); create_role.name = System.Text.Encoding.UTF8.GetBytes(char_name);; create_role.rid = mVocationId; // actor type, 从1开始 create_role.server_id = (uint)GlobalConfig.GetInstance().LoginInfo.ServerInfo.SId; if (string.IsNullOrEmpty(GlobalConfig.GetInstance().LoginInfo.ProviderPassport)) { create_role.chn_passport = System.Text.Encoding.UTF8.GetBytes("provider_passport"); } else { create_role.chn_passport = System.Text.Encoding.UTF8.GetBytes(GlobalConfig.GetInstance().LoginInfo.ProviderPassport); } if (AuditManager.Instance.AuditAndIOS()) { SDKConfig sdkConfig = SDKHelper.GetSDKConfig(); if (sdkConfig != null) { create_role.majia_id = sdkConfig.copy_bag_id; create_role.majia_pack = sdkConfig.copy_bag_id; } } else { SDKConfig sdkConfig = SDKHelper.GetSDKConfig(); if (sdkConfig != null) { create_role.majia_id = 0; create_role.majia_pack = sdkConfig.copy_bag_id; } } ControlServerLogHelper.CreatePkgAccPhoneInfos(create_role.phone_info); NetClient.GetBaseClient().SendData <C2SCreateRole>(NetMsg.MSG_CREATE_ROLE, create_role); // 保存创建角色的名字 GlobalConfig.GetInstance().LoginInfo.Name = char_name; // 记录上一次选中的职业 GlobalSettings.GetInstance().LastActorIndex = Game.GetInstance().CharacterList.Count; GlobalSettings.GetInstance().Save(); Game.Instance.IsCreateRoleEnter = true; UIManager.Instance.ShowWaitScreen(true); // 点击创角按钮 ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.ClickCreateActorButton); ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.create_role); // 点击选角按钮 ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.ClickSelectActorButton); ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.select_role); }
protected override void InitUI() { base.InitUI(); mEnterGameButton = FindChild("EnterGameButton").GetComponent <Button>(); mExitButton = FindChild("ExitButton").GetComponent <Button>(); mGenerateNameButton = FindChild("GenerateNameButton").GetComponent <Button>(); mNameInputField = FindChild("NameInputField").GetComponent <InputField>(); mVocationDesc = FindChild("VocationDesc").transform; mRightButtom = FindChild("RightButtom"); mRight = FindChild("Right"); mHealthTips = FindChild("HealthTips"); mHealthTips.SetActive(false); mCreateNewRoleButton = FindChild("CreateNewRoleButton").GetComponent <Button>(); mCreateNewRoleButton.gameObject.SetActive(false); // 获取最大可创建角色数量 var role_ids = GameConstHelper.GetUintList("GAME_AVAILABLE_ROLE_ID"); mActorNum = role_ids.Count; // 获取创角按钮 mActorButtons.Clear(); if (AuditManager.Instance.AuditAndIOS()) { for (int i = 0; i < mActorNum; ++i) { var btn_game_object = FindChild(string.Format("VocationButton{0}", i + 1)); if (btn_game_object != null) { btn_game_object.gameObject.SetActive(false); } } //int[] actorList = new int[] { 2, 1 ,3 }; List <uint> actorList = SDKHelper.GetRoleList(); if (actorList != null) { bool isShowActorBtn = actorList.Count > 1; for (int i = 0; i < actorList.Count; i++) { int career = (int)actorList[i]; var btn_game_object = FindChild(string.Format("VocationButton{0}", career)); if (btn_game_object != null) { btn_game_object.gameObject.SetActive(isShowActorBtn); btn_game_object.transform.Find("CheckMask").gameObject.SetActive(false); btn_game_object.transform.Find("Background").gameObject.SetActive(true); mActorButtons.Add((uint)career, btn_game_object.GetComponent <Button>()); } } } } else { for (int i = 0; i < mActorNum; ++i) { var btn_game_object = FindChild(string.Format("VocationButton{0}", i + 1)); if (btn_game_object != null) { mActorButtons.Add((uint)(i + 1), btn_game_object.GetComponent <Button>()); } } } mEnterGameButton.onClick.AddListener(OnClickEnterGameBtn); mExitButton.onClick.AddListener(OnClickExitBtn); mGenerateNameButton.onClick.AddListener(OnClickNameBtn); foreach (var kv in mActorButtons) { var btn = kv.Value; if (btn != null) { btn.onClick.AddListener(() => { OnClickActorBtn(kv.Key); }); } } mCreateNewRoleButton.onClick.AddListener(OnClickCreateNewRoleButton); if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) { for (int i = 0; i < 3; i++) { GameObject go = FindChild("ActorPic" + (i + 1).ToString()); if (go != null) { LoadMaJiaImage majia = go.AddComponent <LoadMaJiaImage>(); var picName = string.Format("ActorPic{0}.png", (i + 1)); majia.mPath = ResNameMapping.Instance.GetMappingName(picName); majia.SetFailCallBack(() => { RawImage image = majia.GetComponent <RawImage>(); if (image != null) { image.color = new Color(0, 0, 0, 0); } }); mActorPic.Add(go); } } } Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_CREATE_ROLE, HandleCreateRole); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_RANDNAME_UPDATE, OnRandNameUpdate); }
void UpdateUI() { if (mTimer != null) { mTimer.Destroy(); mTimer = null; } if (mActivityIds == null) { return; } Transform timerTextTrans = this.transform.Find("SysBtn").Find("TimerText"); if (timerTextTrans == null) { GameDebug.LogError("UIGuildLeagueSysBtn UpdateTimerText error!!! Can not find TimerText!!!"); return; } UISysConfigBtn btn = this.gameObject.GetComponent <UISysConfigBtn>(); //当预告开启的时候 预备和资格的 icon不允许显示 if (ActivityHelper.IsActivityOpen(GameConst.SYS_OPEN_LEAGUE_PRE_SHOW)) { btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); return; } // 系统是否开放 bool sysIsOpen = false; foreach (uint activityId in mActivityIds) { if (SysConfigManager.Instance.CheckSysHasOpenIgnoreActivity(activityId)) { sysIsOpen = true; break; } } if (sysIsOpen == false) { btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); return; } bool todayIsOpen = false; foreach (uint activityId in mActivityIds) { if (ActivityHelper.GetActivityInfo <bool>(activityId, "TodayIsOpen") == true) { todayIsOpen = true; break; } } if (todayIsOpen == false) { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } else { DateTime curDateTime = Game.Instance.GetServerDateTime(); uint serverTime = Game.Instance.ServerTime; List <uint> startShowBtnTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_START_SHOW_BTN_TIME"); // 开始显示系统按钮时间(5点) List <uint> confirmTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CONFIRM_TIME"); // 确认对战表时间(19点) List <uint> openTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_OPEN_TIME"); // 活动开启时间(21点) List <uint> closeTimeStr = GameConstHelper.GetUintList("GAME_GUILD_LEAGUE_CLOSE_TIME"); // 活动关闭时间(22点) uint startShowBtnTimeHour = startShowBtnTimeStr[0]; uint startShowBtnTimeMinute = startShowBtnTimeStr[1]; uint confirmTimeHour = confirmTimeStr[0]; uint confirmTimeMinute = confirmTimeStr[1]; uint openTimeHour = openTimeStr[0]; uint openTimeMinute = openTimeStr[1]; uint closeTimeHour = closeTimeStr[0]; uint closeTimeMinute = closeTimeStr[1]; long startShowBtnTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)startShowBtnTimeHour, (int)startShowBtnTimeMinute, 0)); long confirmTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)confirmTimeHour, (int)confirmTimeMinute, 0)); long openTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)openTimeHour, (int)openTimeMinute, 0)); long roundTwoOpenTimestamp = openTimestamp + GameConstHelper.GetUint("GAME_GUILD_LEAGUE_ROUND_TWO_AFTER") * 60; long closeTimestamp = DateHelper.GetTimestamp(new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, (int)closeTimeHour, (int)closeTimeMinute, 0)); long endTimestamp = 0; if (serverTime < startShowBtnTimestamp) // 5点前 { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } else if (serverTime < confirmTimestamp) // 确认参赛资格前 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = openTimestamp; } else if (serverTime < openTimestamp) // 第一轮比赛开启前 { if (GuildLeagueManager.Instance.CanJoinLeague() == true) // 有参赛资格 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = openTimestamp; } else // 没有参赛资格 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } } else if (serverTime < roundTwoOpenTimestamp) // 第二轮比赛开启前 { if (GuildLeagueManager.Instance.RoundOneIsOver() == false) // 第一轮还没结束 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } else // 第一轮已经结束 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); endTimestamp = roundTwoOpenTimestamp; } } else if (serverTime < closeTimestamp) // 22点前 { //this.gameObject.SetActive(true); btn.SetSysBtnState(UISysConfigBtn.SysState.Open); } else // 22点后 { //this.gameObject.SetActive(false); btn.SetSysBtnState(UISysConfigBtn.SysState.NotOpen); } Text timerText = this.transform.Find("SysBtn").Find("TimerText").GetComponent <Text>(); if (endTimestamp > 0) { timerText.gameObject.SetActive(true); if (endTimestamp > serverTime) { long timeOffset = endTimestamp - serverTime; timerText.text = Utils.Timer.GetFMTTime2(1000f * timeOffset); mTimer = new Utils.Timer(timeOffset * 1000, false, 1000, (remainTime) => { if (remainTime > 0) { timerText.text = Utils.Timer.GetFMTTime2(remainTime); } else { timerText.text = ""; timerText.gameObject.SetActive(false); UpdateUI(); } }); } else { GameDebug.LogError("Init UIGuildLeagueSysBtn error, end timestamp is early then cur time!!!"); } } else { timerText.gameObject.SetActive(false); } } ShowEffect(RedPointDataMgr.Instance.GetRedPointVisible(70)); }
/// <summary> /// 随机设置将要攻击的技能 /// </summary> public virtual void SetRandomSkill() { if (mRunningProperty.TargetSkill != null) { return; } if (mRunningProperty.SelfActor.UnitType != EUnitType.UNITTYPE_PLAYER) { int skillCount = mRunningProperty.SelfActor.GetSkillCount(); if (skillCount <= 0) { Debug.LogError("AIBaseFunction::SetRandomSkill failed, do not have any skill"); return; } Actor.SkillCastInfo skillInfo; ushort[] skillRates = new ushort[skillCount]; ushort allRate = 0; for (int i = 0; i < skillCount; ++i) { skillInfo = RunningProperty.SelfActor.GetSkillIDByIndex(i); if (skillInfo == null) { skillRates[i] = 0; continue; } Skill skill = RunningProperty.SelfActor.GetSelfSkill(skillInfo.muiID); if (skill == null) { skillRates[i] = 0; continue; } if (RunningProperty.SelfActor.AttackCtrl.IsSkillCanCast(skill, 0) == false) { skillRates[i] = 0; continue; } skillRates[i] = (ushort)(skillInfo.mbtCastRate); allRate += skillInfo.mbtCastRate; } uint skillId = 0xffffffff; int rand = UnityEngine.Random.Range(0, allRate); int skillIndex = 0; ushort currentTotal = 0; for (int i = 0; i < skillRates.Length; i++) { currentTotal += skillRates[i]; if (rand <= currentTotal) { skillIndex = i; break; } } skillId = RunningProperty.SelfActor.GetSkillIDByIndex(skillIndex); if (skillId != 0xffffffff) { //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId); RunningProperty.TargetSkillId = skillId; } if (RunningProperty.TargetSkill == null) { Debug.LogError(string.Format("BehaviourAI::SetRandomSkill failed,{0} can not get skill:{1}", RunningProperty.SelfActor.TypeIdx, skillId)); return; } else { return; } } else { List <uint> skillIds = new List <uint>(); Dictionary <uint, Skill> .ValueCollection learnedSkills = SkillManager.GetInstance().GetLocalSkill(); foreach (Skill skill in learnedSkills) { if (mRunningProperty.SelfActor.AttackCtrl.IsSkillCanCast(skill, 0) == false) { continue; } if (skill != null) { skillIds.Add(skill.SkillID); } } if (skillIds.Count <= 0) { string normalSkillRaw = string.Format("GAME_AI_NORMAL_SKILL_ID_ROLE_{0}", (int)RunningProperty.SelfActor.VocationID); uint skillId = GameConstHelper.GetUint(normalSkillRaw); if (skillId > 0) { //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId); skillId = skillId; UINotice.Instance.ShowMessage(xc.DBConstText.GetText("AI_TURN_TO_NORMAL_SKILL_TIPS")); } } // 随机技能 int randIndex = UnityEngine.Random.Range(0, skillIds.Count); if (randIndex < skillIds.Count) { uint skillId = skillIds[randIndex]; //RunningProperty.TargetSkill = RunningProperty.SelfActor.GetSelfSkill(skillId); skillId = skillId; } } return; }
IEnumerator AutoPickCoroutine() { yield return(new SafeCoroutine.SafeWaitForSeconds(GameConstHelper.GetFloat("GAME_AUTO_PICK_DROP_DELAY"))); Pick(); }
void Start() { mCD = GameConstHelper.GetFloat("GAME_MWAR_PICK_CD"); }
//-------------------------------------------------------- // 虚函数 //-------------------------------------------------------- protected override void InitUI() { base.InitUI(); mSelectedServerInfo = null; mMaintainingServerTimers = new List <Utils.DecimalTimer>(); mMaintainingServerTimers.Clear(); // 登录界面 m_MaskObject = FindChild("mask"); //mLoginPanel = FindChild<Transform>("LoginPanel").gameObject; mLoadingIcon = FindChild <Transform>("LoadingIcon").gameObject; mLoadingIcon.SetActive(false); mSelectedServerStateImage = FindChild <Image>("ServerStateImage"); mSelectedServerNameText = FindChild <Text>("ServerNameText"); mLoginButton = FindChild <Button>("LoginButton"); mLoginButton.onClick.AddListener(OnClickLoginButton); mGotoServerListButton = FindChild <Button>("ChooseServerButton"); mGotoServerListButton.onClick.AddListener(OnClickGotoServerListButton); mBtnAnnouncement = FindChild <Transform>("AnnouncementButton").gameObject.GetComponent <Button>(); mBtnAnnouncement.onClick.AddListener(onShowLoginNotice); mUserButton = FindChild <Transform>("UserButton").gameObject.GetComponent <Button>(); bool isShowUserCenterButton = true; string isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER"); if (isShowUserCenterButtonStr == "" || isShowUserCenterButtonStr == "0") { isShowUserCenterButton = false; } mUserButton.gameObject.SetActive(isShowUserCenterButton); mUserButton.onClick.AddListener(OnClickUserButton); mLogo = FindChild <Image>("Logo"); mCustomLogoRawImage = FindChild <RawImage>("CustomLogoRawImage"); //IOS #if UNITY_IPHONE mLogo.gameObject.SetActive(true); mCustomLogoRawImage.gameObject.SetActive(false); LoadMaJiaImage majiaImage = mLogo.gameObject.AddComponent <LoadMaJiaImage>(); var logoName = "logo.png"; majiaImage.mPath = ResNameMapping.Instance.GetMappingName(logoName); GameObject go = FindChild("Bg"); LoadMaJiaImage majiaBg = go.AddComponent <LoadMaJiaImage>(); var picName = "QuickLogin.jpg"; majiaBg.mPath = ResNameMapping.Instance.GetMappingName(picName); #endif mKVPanel = FindChild("KVPanel"); if (mKVPanel != null) { //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) // mKVPanel.SetActive(false); #if UNITY_IPHONE mKVPanel.SetActive(SDKHelper.GetAuditInfo("is_show_login_kv")); #endif } mVersionInfoText = FindChild <Text>("VersionInfoText"); mBgParent = FindChild("BgParent"); SetSelectedServerInfo(null); if (Const.Region != RegionType.CHINA) { // 隐藏健康提示 var login_panel_trans = FindChild <Transform>("LoginPanel"); if (login_panel_trans != null) { var health_text = login_panel_trans.Find("Text"); if (health_text != null) { health_text.gameObject.SetActive(false); } } } #if UNITY_ANDROID RawImage bgImage = FindChild <RawImage>("Bg"); GameObject effect = FindChild("Effect"); // 安卓平台从assets文件夹查找是否存在"login_bg.jpg"图片,存在则优先显示 string imageFileName = "login_bg.jpg"; byte[] imageData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(imageFileName); if (imageData != null) { TextureFormat textureFormat = TextureFormat.DXT1; int width = Screen.currentResolution.width; int height = Screen.currentResolution.height; Texture2D newTexture2D = new Texture2D(width, height, textureFormat, false); newTexture2D.LoadImage(imageData); bgImage.texture = newTexture2D; effect.SetActive(false); } else { //GameDebug.LogError("Error, Can not load loading bg image: " + imageFileName); effect.SetActive(true); } #endif ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SELECT_SERVER, OnSelectServerChange); }
public void Awake() { if (SceneHelp.Instance.IsInWeddingInstance == true) // 婚宴副本外面使用第二套模型 { mModelIds = GameConstHelper.GetUintList("GAME_WEDDING_DRAMA_TIMELINE_COUPLE_MODEL_IDS"); } else { mModelIds = GameConstHelper.GetUintList("GAME_WEDDING_DRAMA_TIMELINE_COUPLE_MODEL_IDS_2"); } PlayableDirector playableDirector = gameObject.GetComponent <PlayableDirector>(); if (playableDirector != null) { uint rid1 = 0; uint rid2 = 0; MarryHelper.GetWeddingCoupleJobs(out rid1, out rid2); TimelineAsset asset = playableDirector.playableAsset as TimelineAsset; foreach (TrackAsset track in asset.GetOutputTracks()) { GroupTrack group = track.GetGroup(); if (group != null) { if (group.name.Equals("Mate") == true) { foreach (PlayableBinding output in track.outputs) { if (output.sourceObject != null) { Object binding = playableDirector.GetGenericBinding(output.sourceObject); if (binding == null) { GameDebug.LogError("Player wedding chapel timeline " + this.name + " error!!! " + output.sourceObject.name + " 's binding object is null!!!"); continue; } GameObject bindingObj = binding as GameObject; // 根据职业显示主角的模型 if (bindingObj != null) { if (bindingObj.name.Equals("Mate_R") == true) { if (rid1 > 0) { bindingObj.SetActive(false); ReplaceActorModel(playableDirector, output, bindingObj, rid1, bindingObj.name); } } if (bindingObj.name.Equals("Mate_L") == true) { if (rid2 > 0) { bindingObj.SetActive(false); ReplaceActorModel(playableDirector, output, bindingObj, rid2, bindingObj.name); } } } } } } } } } // 跳过按钮 Transform skipButtonTrans = gameObject.transform.Find("UI/Canvas/SkipButton"); if (skipButtonTrans != null) { Button skipButton = skipButtonTrans.GetComponent <Button>(); if (skipButton != null) { skipButton.onClick.RemoveAllListeners(); skipButton.onClick.AddListener(() => { TimelineManager.Instance.StopAll(); }); } } GameInput.Instance.EnableInput(true, true); }
/// <summary> /// 进行更新检查 /// </summary> /// <returns></returns> public IEnumerator StartLogingCheck() { // 读取游戏常量表的配置 bool isSupportGrayServer = false; #if UNITY_IPHONE if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER_IOS") > 0) { isSupportGrayServer = true; } #else if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER") > 0) { isSupportGrayServer = true; } #endif // 检查当前包是否支持灰度服的更新检查 if (!GrayServerManager.Instance.IsSupportGrayServer() || !isSupportGrayServer) { OnEnterGame(); yield break; } // 上次登录的服务器ID与当前服务器ID相同时,不需要检查灰度服更新 var lastServerId = GrayServerManager.Instance.GetLoginServer(); var curServerId = 0; if (GlobalConfig.Instance.LoginInfo != null && GlobalConfig.Instance.LoginInfo.ServerInfo != null) { curServerId = GlobalConfig.Instance.LoginInfo.ServerInfo.SId; } if (lastServerId == curServerId) { OnEnterGame(); yield break; } // 记录最新的服务器ID GrayServerManager.Instance.RecordLoginServer(curServerId); #if UNITY_EDITOR // editor下使用android的资源来测试 var server_url = @"http://s01.huiwaninfo.net:8087/XControl/v2/servlet/UpdateCheck?game_mark=zl_cehua&platform=android&appv=2.0.0&libv=0.0.0&imei=359786050902015&device_mark=&cpu=Intel&extend=&api_ver=1.0&res_v=1&res_v=1"; #else var server_url = DBOSManager.getOSBridge().getUpdateCheckUrl(); #endif // 获取最新资源版本 GrayServerManager.Instance.SetUpdateURL(server_url); yield return(MainGame.HeartBehavior.StartCoroutine(GrayServerManager.Instance.CheckUpdate(curServerId))); var updateInfo = GrayServerManager.Instance.UpdateInfo; bool needUpdate = false; if (updateInfo != null) { // 判断是否有更新 var versionInfo = VersionInfoManager.Instance.LocalVersionInfo; if (versionInfo != null) { foreach (var info in versionInfo) { var local_version = info.Value; var server_version = 0; if (updateInfo.TryGetValue(info.Key, out server_version)) { if (local_version < server_version) { needUpdate = true; break; } } } } } if (mCheckCoroutine != null) { MainGame.HeartBehavior.StopCoroutine(mCheckCoroutine); mCheckCoroutine = null; } // 有更新时需要重新启动游戏 if (needUpdate) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg("检测到游戏资源有更新,请重启游戏进行更新操作。", (x) => { DBOSManager.getOSBridge().reboot(); }); } else { OnEnterGame(); } }
void Awake() { RED_POINT_DELTA_X = GameConstHelper.GetInt("HANDBOOK_RED_POINT_DELTA_X"); RED_POINT_DELTA_Y = GameConstHelper.GetInt("HANDBOOK_RED_POINT_DELTA_Y"); HANDBOOK_MIN_STAR = GameConstHelper.GetInt("HANDBOOK_MIN_STAR"); if (handbookName == null) { handbookName = this.transform.Find("Name").GetComponent <Text>(); } if (handbookPicture == null) { handbookPicture = this.transform.Find("Picture").GetComponent <RawImage>(); } if (handbookBorder == null) { handbookBorder = this.transform.Find("bg").GetComponent <Image>(); } if (handbookInactiveMark == null) { handbookInactiveMark = this.transform.Find("NotText").gameObject; } if (firstFiveStars == null || firstFiveStars.Count <= 0) { firstFiveStars = new List <GameObject>(); var starParent1 = this.transform.Find("StarPanel"); for (int i = 0; i < starParent1.childCount; i++) { firstFiveStars.Add(starParent1.GetChild(i).gameObject); } } if (moreThanFiveStars == null) { moreThanFiveStars = this.transform.Find("StarPanel2/StarBg_1").gameObject; } if (moreThanFiveStarsCount == null) { moreThanFiveStarsCount = this.transform.Find("StarPanel2/Text").GetComponent <Text>(); } if (handbookFullMark == null) { handbookFullMark = this.transform.Find("Max").gameObject; } if (handbookToggle == null) { handbookToggle = this.transform.GetComponent <Toggle>(); } if (handbookToggle != null) { handbookToggle.onValueChanged.AddListener((isOn) => { if (isOn) { OnHandBookItemClick?.Invoke(handbookID); } }); } if (redPoint == null) { redPoint = this.gameObject.AddComponent <RedPoint>(); redPoint.DeltaX = RED_POINT_DELTA_X; redPoint.DeltaY = RED_POINT_DELTA_Y; } //两个特效策划让对换一下 if (activateEff == null) { var trans = this.transform.Find("EF_UI_tujian_shengxing"); if (trans != null) { activateEff = trans.gameObject; } } if (upgradeEff == null) { var trans = this.transform.Find("EF_UI_tujian_jihuo"); if (trans != null) { upgradeEff = trans.gameObject; } } Reset(); }