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 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; } }
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"); }
/// <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)); }
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; } }
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"); }
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; }
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; }
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); }
IEnumerator AutoPickCoroutine() { yield return(new SafeCoroutine.SafeWaitForSeconds(GameConstHelper.GetFloat("GAME_AUTO_PICK_DROP_DELAY"))); Pick(); }
void Start() { mCD = GameConstHelper.GetFloat("GAME_MWAR_PICK_CD"); }
void Init() { mTextObject = ObjCachePoolMgr.Instance.LoadFromCache(mPoolType, mPoolKey) as GameObject; if (mTextObject == null) { mTextObject = (GameObject)GameObject.Instantiate(mHudActorWin.TextObj); PoolGameObject pg = mTextObject.AddComponent <PoolGameObject>(); pg.poolType = mPoolType; pg.key = mPoolKey; } Transform textTrans = mTextObject.transform; textTrans.SetParent(mHudActorWin.TextRootTrans); textTrans.localPosition = Vector3.zero; textTrans.localScale = mScale; // 激活VerticalLayoutGroup var layout_trans = textTrans.Find("Layout"); if (layout_trans != null) { CommonTool.SetActive(layout_trans.gameObject, true); var vert_layout = layout_trans.GetComponent <VerticalLayoutGroup>(); if (vert_layout != null) { if (!vert_layout.enabled) { vert_layout.enabled = true; } } } mTextObject.SetActive(true); mTextLabel = UIHelper.FindChild(textTrans, "TextLabel").GetComponent <Text>(); if (mTextLabel != null) { mDefaultFontSize = mTextLabel.fontSize; // 保存默认的字体大小 } mGuildNameTextLabel = UIHelper.FindChild(textTrans, "GuildNameTextLabel").GetComponent <Text>(); //帮派名 mMateNameTextLabel = UIHelper.FindChild(textTrans, "MateNameTextLabel").GetComponent <Text>(); //帮派名 mRankTextLabel = UIHelper.FindChild(textTrans, "RankTextLabel").GetComponent <Text>(); //排名 mHangUpTextLabel = UIHelper.FindChild(textTrans, "HangUpTextLabel").GetComponent <Text>(); //挂机中 mTextLabel.text = mTextString; mGuildNameTextLabel.gameObject.SetActive(false); mMateNameTextLabel.gameObject.SetActive(false); mRankTextLabel.gameObject.SetActive(false); mHangUpTextLabel.gameObject.SetActive(false); mBGSprite = UIHelper.FindChild(textTrans, "BGSprite").GetComponent <Image>(); mPreBGSprite = UIHelper.FindChild(textTrans, "PreBGSprite").GetComponent <Image>(); mPeakTeamIconImage = UIHelper.FindChild(textTrans, "PeakTeamIconImage").GetComponent <Image>(); mTeamIconImage = UIHelper.FindChild(textTrans, "TeamIconImage").GetComponent <Image>(); mAffiliationPanel = UIHelper.FindChild(textTrans.gameObject, "AffiliationPanel").transform; mHpBar = UIHelper.FindChild(textTrans.gameObject, "PlayerHpBar").transform; mHpBar.gameObject.SetActive(false); mHpBarForegroundFillImage = mHpBar.Find("Foreground/Fill Area/Fill").GetComponent <Image>(); mHonorPanel = UIHelper.FindChild(textTrans, "HonorPanel"); mHonorPanel.SetActive(false); mHonorIcon = UIHelper.FindChild(textTrans, "HonorIcon").GetComponent <Image>(); mHonorIcon.gameObject.SetActive(true); mTitleIcon = UIHelper.FindChild(textTrans, "TitleIcon").GetComponent <Image>(); mTitleIcon.gameObject.SetActive(false); mTitleEffect = mTitleIcon.transform.Find("Effect").GetComponent <RawImage>(); mTitleEffect.gameObject.SetActive(false); m_hpBarScript = mHpBar.gameObject.GetComponent <UIPlayerHpBar>(); if (m_hpBarScript == null) { m_hpBarScript = mHpBar.gameObject.AddComponent <UIPlayerHpBar>(); } DialogBubbleParent = UIHelper.FindChild(textTrans.gameObject, "ChatMsgBg").transform; DialogBubbleText = UIHelper.FindChild(textTrans.gameObject, "ChatMsgText").GetComponent <EmojiText>(); DialogChatMsgArrow = UIHelper.FindChild(textTrans.gameObject, "ChatMsgArrow").transform; mButton = textTrans.Find("Button").GetComponent <Button>(); mButton.gameObject.SetActive(false); mTrans = textTrans; mOwnerTrans = transform; if (mStyleInfo != null) { mBGSprite.gameObject.SetActive(mStyleInfo.IsShowBg); mPreBGSprite.gameObject.SetActive(mStyleInfo.IsShowBgPreHead); mTeamIconImage.gameObject.SetActive(mStyleInfo.IsShowTeamIcon); IsShowAffiliationPanel = mStyleInfo.IsShowAffiliationPanel; } else { mBGSprite.gameObject.SetActive(false); mPreBGSprite.gameObject.SetActive(false); IsShowAffiliationPanel = false; mTeamIconImage.gameObject.SetActive(false); } mPeakTeamIconImage.gameObject.SetActive(false); mMaxVisibleDistanceSquare = GameConstHelper.GetFloat("GAME_MWAR_ACTOR_HEAD_TEXT_MAX_VISIBLE_DISTANCE_SQUARE"); }