public void RadioButtonSelected(RadioButtonView view, RadioButtonView.RadioButtonStatus buttonStates) { if (CheckUtil.ListIsNull(listButton)) { return; } for (int i = 0; i < listButton.Count; i++) { RadioButtonView itemRB = listButton[i]; if (itemRB.Equals(view)) { if (!isCancelSelect) { itemRB.ChangeStates(RadioButtonView.RadioButtonStatus.Selected); } if (mRGCallBack != null) { mRGCallBack.RadioButtonSelected(this, i, itemRB); } } else { itemRB.ChangeStates(RadioButtonView.RadioButtonStatus.Unselected); if (mRGCallBack != null) { mRGCallBack.RadioButtonUnSelected(this, i, itemRB); } } } }
public void CreateCharacterList(List <MiniGameCharacterBean> listCharacterData, List <Vector3> listCharacterPosition, NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum npcType) { if (CheckUtil.ListIsNull(listCharacterData)) { return; } for (int i = 0; i < listCharacterData.Count; i++) { MiniGameCharacterBean itemCharacterData = listCharacterData[i]; NpcAIMiniGameCookingCpt npcCpt = CreateCharacter(itemCharacterData, listCharacterPosition[i], npcType); switch (npcType) { case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Player: listEnemyCharacter.Add(npcCpt); npcCpt.characterMoveCpt.SetMoveSpeed(5); break; case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Auditer: listAuditerCharacter.Add(npcCpt); break; case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Compere: listCompereCharacter.Add(npcCpt); break; } } }
protected void ChangeCharacter(int number) { if (CheckUtil.ListIsNull(listCharacter)) { return; } int nextPosition = 0; for (int i = 0; i < listCharacter.Count; i++) { CharacterBean itemCharater = listCharacter[i]; if (itemCharater == characterData) { nextPosition = i + number; if (nextPosition >= listCharacter.Count) { nextPosition = nextPosition - listCharacter.Count; } else if (nextPosition < 0) { nextPosition = listCharacter.Count + nextPosition; } break; } } SetCharacterData(listCharacter, listCharacter[nextPosition]); RefreshUI(); }
/// <summary> /// 还贷 /// </summary> /// <returns></returns> public void PayLoans(out List <UserLoansBean> listPayLoans) { listPayLoans = new List <UserLoansBean>(); if (CheckUtil.ListIsNull(listLoans)) { return; } for (int i = 0; i < listLoans.Count; i++) { UserLoansBean itemLoans = listLoans[i]; if (HasEnoughMoney(0, 0, itemLoans.moneySForDay)) { //支付金钱 PayMoney(0, 0, itemLoans.moneySForDay); //剩余的还贷日期-1 itemLoans.residueDays -= 1; //已经还过的列表+1 listPayLoans.Add(itemLoans); //如果已经还完 if (itemLoans.residueDays <= 0) { listLoans.Remove(itemLoans); i--; } } } }
/// <summary> /// 设置文本数据 /// </summary> /// <param name="listData"></param> public void SetTextInfoData(List <TextInfoBean> listData) { if (!CheckUtil.ListIsNull(listData)) { characterInt.ShowInteractive(listData[0].name); } }
/// <summary> /// 创建图书列表 /// </summary> /// <param name="listData"></param> public void CreateBookList(List <ItemsInfoBean> listData) { CptUtil.RemoveChildsByActive(objBookItemContainer); if (CheckUtil.ListIsNull(listData)) { tvNull.gameObject.SetActive(true); return; } else { tvNull.gameObject.SetActive(false); } for (int i = 0; i < listData.Count; i++) { ItemsInfoBean itemData = listData[i]; if (!listBook.Contains(itemData.id)) { continue; } GameObject objItem = Instantiate(objBookItemContainer, objBookItemModel); ItemBaseTextCpt itemBaseText = objItem.GetComponent <ItemBaseTextCpt>(); PopupItemsButton infoItemsPopup = objItem.GetComponent <PopupItemsButton>(); Sprite spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(itemData.icon_key); itemBaseText.SetData(spIcon, itemData.name, ""); infoItemsPopup.SetData(itemData, spIcon); } }
/// <summary> /// 修改生命值 /// </summary> /// <param name="life"></param> public int AddLife(int life) { characterLife += life; if (characterLife <= 0) { characterLife = 0; SetIntent(RascalIntentEnum.Leave); long[] shoutIds = teamData.GetShoutIds(); TextInfoHandler.Instance.manager.GetTextForTalkByMarkId(shoutIds[1], SetTextInfoData); //随机获取一句喊话 if (!CheckUtil.ListIsNull(listShoutTextInfo)) { TextInfoBean textInfo = RandomUtil.GetRandomDataByList(listShoutTextInfo); characterShoutCpt.Shout(textInfo.content); } //快速离开 characterMoveCpt.SetMoveSpeed(5); } else if (characterLife > characterMaxLife) { characterLife = characterMaxLife; } characterLifeCpt.SetData(characterLife, characterMaxLife); return(characterLife); }
protected void SetGoldPileData() { goldPileData = ""; for (int i = 0; i < listGoldPile.Length; i++) { GameObject itemObj = listGoldPile[i]; if (itemObj == null) { continue; } goldPileData += (itemObj.name + ":" + itemObj.transform.position.x + "," + itemObj.transform.position.y + "," + itemObj.transform.position.z + "|"); DestroyImmediate(itemObj); } if (CheckUtil.StringIsNull(goldPileData)) { return; } List <GameLevelBean> listData = gameLevelService.QueryDataByLevel(levelForGame); if (!CheckUtil.ListIsNull(listData)) { GameLevelBean gameLevelData = listData[0]; gameLevelData.gold_pile = goldPileData; gameLevelService.InsertDataByLevel(gameLevelData); } }
/// <summary> /// 获取最近的楼梯 /// </summary> /// <param name="position"></param> /// <returns></returns> public BuildStairsCpt GetCloseStairs(Vector3 position) { if (CheckUtil.ListIsNull(listStairsCpt)) { return(null); } float tempDistance = float.MaxValue; BuildStairsCpt closeStairs = null; for (int i = 0; i < listStairsCpt.Count; i++) { BuildStairsCpt buildStairs = listStairsCpt[i]; //如果不能到达则不用 if (!CheckUtil.CheckPath(position, buildStairs.GetStairsPosition())) { continue; } float itemDistance = Vector3.Distance(position, buildStairs.GetStairsPosition()); if (tempDistance > itemDistance) { closeStairs = buildStairs; tempDistance = itemDistance; } } return(closeStairs); }
protected static RewardTypeBean GetRandomRewardForData(List <CharacterBean> listEnemyData, RewardTypeEnum rewardType, string rewardListStr) { if (CheckUtil.StringIsNull(rewardListStr)) { return(null); } List <string> listReward = StringUtil.SplitBySubstringForListStr(rewardListStr, '|'); string randomReward = RandomUtil.GetRandomDataByList(listReward); string rewardDataStr; if (randomReward.Equals("Skills")) { //如果没有传入敌人则不获取技能 if (CheckUtil.ListIsNull(listEnemyData)) { return(GetRandomRewardForData(listEnemyData, rewardType, rewardListStr)); } List <long> listSkills = new List <long>(); for (int i = 0; i < listEnemyData.Count; i++) { CharacterBean characterData = listEnemyData[i]; listSkills.AddRange(characterData.attributes.listSkills); } long randomSkill = RandomUtil.GetRandomDataByList(listSkills); rewardDataStr = (1400000 + randomSkill) + ""; } else { rewardDataStr = randomReward; } RewardTypeBean rewardData = new RewardTypeBean(rewardType, rewardDataStr); return(rewardData); }
/// <summary> /// 开始制造麻烦 /// </summary> /// <returns></returns> public IEnumerator CoroutineForStartMakeTrouble() { while (rascalIntent == RascalIntentEnum.MakeTrouble || rascalIntent == RascalIntentEnum.ContinueMakeTrouble) { if (isMove) { movePosition = InnHandler.Instance.GetRandomInnPositon(); bool canGo = CheckUtil.CheckPath(transform.position, movePosition); if (canGo) { characterMoveCpt.SetDestination(movePosition); } } //随机获取一句喊话 //int shoutId = Random.Range(13101, 13106); if (!CheckUtil.ListIsNull(listShoutTextInfo)) { TextInfoBean textInfo = RandomUtil.GetRandomDataByList(listShoutTextInfo); characterShoutCpt.Shout(textInfo.content); } yield return(new WaitForSeconds(5)); //时间到了就离开 timeMakeTrouble -= 5; if (timeMakeTrouble <= 0) { SetIntent(RascalIntentEnum.Leave); } } }
public void SetData(UserModelDataBean userModelData, ModelInfoBean modelInfo) { if (modelInfo == null) { return; } if (userModelData == null) { return; } dissolveAmountId = Shader.PropertyToID(m_DissolveAmount); mapMaterialForModel.Clear(); Texture textureDisolveGuide = Resources.Load("Texture/noise_1") as Texture; if (!CheckUtil.ListIsNull(modelInfo.listPartData)) { for (int i = 0; i < modelInfo.listPartData.Count; i++) { ModelPartInfoBean partInfo = modelInfo.listPartData[i]; Renderer itemRenderer = CptUtil.GetCptInChildrenByName <Renderer>(gameObject, partInfo.part_name); //获取所有的Material List <Material> listMaterial = new List <Material>(); itemRenderer.GetMaterials(listMaterial); //获取用户进度 UserModelPartDataBean userModelPartData = userModelData.GetUserPartDataById(partInfo.id); float pro = 0; if (userModelPartData != null) { pro = userModelPartData.GetProgress(partInfo.max_level); } //重新设置所有的shader foreach (Material itemMaterial in listMaterial) { Texture itemTexture = itemMaterial.GetTexture("_MainTex"); if (itemTexture) { itemMaterial.shader = Shader.Find("ASESampleShaders/Community/DissolveBurnWithFire"); itemMaterial.SetTexture("_Albedo", itemTexture); itemMaterial.SetTexture("_Normal", itemTexture); itemMaterial.SetTexture("_BurnRamp", itemTexture); itemMaterial.SetFloat("_MaskClipValue", 0.5f); } else { Color color = itemMaterial.GetColor("_Color"); itemMaterial.shader = Shader.Find("ASESampleShaders/Community/DissolveBurn_01"); itemMaterial.SetFloat("_Cutoff", 0.5f); itemMaterial.SetColor("_MainColor", color); } itemMaterial.SetTexture("_DisolveGuide", textureDisolveGuide); itemMaterial.SetFloat(dissolveAmountId, 1 - pro); } if (!mapMaterialForModel.ContainsKey(partInfo.part_name)) { mapMaterialForModel.Add(partInfo.part_name, listMaterial); } } } }
private LevelUpBean GetFirstData(List <LevelUpBean> listData) { if (!CheckUtil.ListIsNull(listData)) { return(listData[0]); } return(null); }
/// <summary> /// 移除所有观察者 /// </summary> public void RemoveAllObserver() { if (CheckUtil.ListIsNull(mObserverList)) { return; } mObserverList.Clear(); }
/// <summary> /// 通过反射调用类的方法(SayHello(string name)) /// </summary> public static string GetInvokeMethod(GameObject gameObject, string componentName, string methodName, List <string> listParameter) { Component component = gameObject.GetComponent(componentName); // 1.Load(命名空间名称),GetType(命名空间.类名) Type type = component.GetType(); // Type type = Assembly.Load(className).GetType(className+"."+className); //2.GetMethod(需要调用的方法名称) MethodInfo method = type.GetMethod(methodName); // 3.调用的实例化方法(非静态方法)需要创建类型的一个实例 //object obj = Activator.CreateInstance(type); //4.方法需要传入的参数 //object[] parameters = new object[] { 1 }; // 5.调用方法,如果调用的是一个静态方法,就不需要第3步(创建类型的实例) // 相应地调用静态方法时,Invoke的第一个参数为null object[] parameters; if (CheckUtil.ListIsNull(listParameter)) { parameters = new object[0]; } else { parameters = new object[listParameter.Count]; for (int i = 0; i < listParameter.Count; i++) { string itemData = listParameter[i]; if (itemData.Equals("true")) { parameters[i] = true; } else if (itemData.Equals("false")) { parameters[i] = false; } else if (int.TryParse(itemData, out int outInt)) { parameters[i] = outInt; } else if (long.TryParse(itemData, out long outLong)) { parameters[i] = outLong; } else if (float.TryParse(itemData, out float outFloat)) { parameters[i] = outFloat; } else { parameters[i] = itemData; } } } string result = (string)method.Invoke(component, parameters); return(result); }
/// <summary> /// 获取山顶门坐标 /// </summary> /// <returns></returns> public Vector3 GetMountainDoorPosition() { if (CheckUtil.ListIsNull(listTownDoor)) { return(Vector3.zero); } Transform tfDoor = RandomUtil.GetRandomDataByList(listMountainDoor); return(tfDoor.transform.position); }
/// <summary> /// 获取随机城镇门坐标 /// </summary> /// <returns></returns> public Vector3 GetRandomTownDoorPosition() { if (CheckUtil.ListIsNull(listTownDoor)) { return(Vector3.zero); } Transform tfTownDoor = RandomUtil.GetRandomDataByList(listTownDoor); return(GameUtil.GetTransformInsidePosition2D(tfTownDoor)); }
/// <summary> /// 获取开始的随机地点 /// </summary> /// <returns></returns> public Vector3 GetRandomStartPosition() { if (CheckUtil.ListIsNull(listStartPosition)) { return(Vector3.zero); } Transform startPosition = RandomUtil.GetRandomDataByList(listStartPosition); return(GameUtil.GetTransformInsidePosition2D(startPosition)); }
/// <summary> /// 获取随机客栈区域出入口坐标 /// </summary> /// <param name="num">编号</param> /// <returns></returns> public Vector3 GetRandomSceneExportPosition(int num) { if (CheckUtil.ListIsNull(listSceneExport) || num > listSceneExport.Count - 1) { return(Vector3.zero); } Transform tfTownDoor = listSceneExport[num]; return(GameUtil.GetTransformInsidePosition2D(tfTownDoor)); }
public virtual MiniGameCharacterBean GetUserGameData() { if (CheckUtil.ListIsNull(listUserGameData)) { return(null); } else { return(listUserGameData[0]); } }
/// <summary> /// 移除观察者列表 /// </summary> /// <param name="observerList"></param> public void RemoveObserverList(List <T> observerList) { if (CheckUtil.ListIsNull(mObserverList) || CheckUtil.ListIsNull(observerList)) { return; } for (int i = 0; i < observerList.Count; i++) { RemoveObserver(observerList[i]); } }
/// <summary> /// 移除观察者 /// </summary> /// <param name="observer"></param> public void RemoveObserver(T observer) { if (CheckUtil.ListIsNull(mObserverList) || observer == null) { return; } if (mObserverList.Contains(observer)) { mObserverList.Remove(observer); } }
public virtual void PlayClip() { if (CheckUtil.ListIsNull(clickClip)) { return; } volume = GameCommonInfo.GameConfig.soundVolume; AudioClip audioClip = RandomUtil.GetRandomDataByList(clickClip); AudioSource.PlayClipAtPoint(audioClip, button.transform.position, volume); }
private void Start() { if (CheckUtil.ListIsNull(listButton)) { return; } foreach (RadioButtonView itemRB in listButton) { itemRB.SetCallBack(this); } }
public virtual void PlayClip() { if (CheckUtil.ListIsNull(clickClip)) { return; } GameConfigBean gameConfig = GameDataHandler.Instance.manager.GetGameConfig(); AudioClip audioClip = RandomUtil.GetRandomDataByList(clickClip); AudioSource.PlayClipAtPoint(audioClip, button.transform.position, gameConfig.soundVolume); }
/// <summary> /// 获取第一个解锁的模型 /// </summary> /// <returns></returns> public UserModelDataBean GetFirstUnlockModel() { if (CheckUtil.ListIsNull(listUnlockModel)) { return(null); } else { return(listUnlockModel[0]); } }
/// <summary> /// 清理所有杯子 /// </summary> public void CleanAllCup() { if (CheckUtil.ListIsNull(listCup)) { return; } foreach (GambleTrickyCupItem itemCupt in listCup) { Destroy(itemCupt.gameObject); } listCup.Clear(); }
/// <summary> /// 初始化所有杯子 /// 随机设置一个杯子有骰子 /// 设置所有杯子状态 /// </summary> public void InitAllCup() { if (CheckUtil.ListIsNull(listCup)) { return; } for (int i = 0; i < listCup.Count; i++) { GambleTrickyCupItem itemCup = listCup[i]; itemCup.SetStatus(GambleTrickyCupItem.CupStatusEnum.Idle); } }
public void WebRequestGetSuccess(string url, SteamWebPlaySummariesBean data) { if (data == null || data.response == null || CheckUtil.ListIsNull(data.response.players)) { return; } SetUserName(data.response.players[0].personaname); //获取头像 WebRequest webRequest = new WebRequest(); StartCoroutine(webRequest.GetSprice(data.response.players[0].avatar, this)); }
/// <summary> /// 增加观察者列表 /// </summary> /// <param name="observerList"></param> public void AddObserver(List <T> observerList) { if (CheckUtil.ListIsNull(observerList)) { return; } if (mObserverList == null) { mObserverList = new List <T>(); } mObserverList.AddRange(observerList); }