private void wizardPage1_Initialize(object sender, WizardPageInitEventArgs e) { if (tutState.Contains(TutorialState.AvatarSelection)) { wizardControl1.NextPage(Step2); } }
//显示操作列表 public void ShowCanOpration(RepeatedField <int> oprationList, RepeatedField <int> gangLits = null) { Show(); HideAllBtn();//先隐藏所有Btn int pengGangCount = 0; if (!oprationList.Contains(FiveStarOperateType.Liang))//只要不是亮牌操作 就有弃 { _QiBtn.gameObject.SetActive(true); } if (oprationList.Contains(FiveStarOperateType.Peng)) { pengGangCount++; } if (oprationList.Contains(FiveStarOperateType.MingGang)) { if (gangLits == null) { Log.Error("服务器发过来可以杠 但没有杠牌列表"); return; } pengGangCount += gangLits.Count; } //创建对应的碰杠需要对象 CreatePengGangBtn(pengGangCount); //当前使用到碰杠列表下标索引 int cuurPengGangBtnIndex = 0; for (int i = 0; i < oprationList.Count; i++) { if (oprationList[i] == FiveStarOperateType.Peng) { _pengGangBtns[cuurPengGangBtnIndex++].SetUI(FiveStarOperateType.Peng, CardFiveStarRoom.Ins.iEndChuCardSize); } else if (oprationList[i] == FiveStarOperateType.MingGang) { for (int j = 0; j < gangLits.Count; j++) { _pengGangBtns[cuurPengGangBtnIndex++].SetUI(FiveStarOperateType.MingGang, gangLits[j]); } } else if (oprationList[i] == FiveStarOperateType.FangChongHu) { _HuBtn.gameObject.SetActive(true); } else if (oprationList[i] == FiveStarOperateType.Liang) { _LiangBtn.gameObject.SetActive(true); } } }
public static async Task <List <User> > QueryUserInfo(RepeatedField <long> userId) { List <User> users = await Game.Scene.GetComponent <DBProxyComponent>() .Query <User>(user => userId.Contains(user.UserId)); return(users); }
//刷新手牌UI 只管手牌UI public void RefreshHandUI(RepeatedField <int> hands) { //先直接清除所有手牌 ClearHands(); _HandPatent.GetComponent <HorizontalLayoutGroup>().enabled = true;//刷新牌之前启用网格 int moreCard = -1; if (hands.Count % 3 == 2) //如果是 碰杠之后刷新 手牌 会多一张 移到新手牌那 { if (_IsCanChuCard && hands.Contains(_NewHand.CardSize)) //若果当前 是自己出牌 尽量摸牌 位置放原有牌 { moreCard = _NewHand.CardSize; } else { moreCard = hands[hands.Count - 1]; } hands.Remove(moreCard); } //更新手牌UI 刷新牌 for (int i = 0; i < hands.Count; i++) { _HandLists.Add(CardFiveStarCardPool.Ins.CreateHand(hands[i], i, _HandPatent)); } _NewHand.SetActive(false); if (moreCard > 0)//如果多的牌 就放在 摸的牌的显示 { _NewHand.SetCardUI(moreCard); hands.Add(moreCard); } }
// watch and unwatch region public void RegionWatch(RepeatedField <Region> rs) { // destroy actors out of the regions /* this lock is not necessary */ //lock( _agents ) { List <long> ids = new List <long>(_agents.Keys); foreach (long id in ids) { AgentUtils <OBJECT> .Agent agent = _agents[id]; /* this lock is not necessary */ //lock( _agents_listener ) //TODO need lock? { Region region = agent.region; if (null != region) { if (false == rs.Contains(region)) { _agents_listener.ialDestroy(id, agent.obj); _agents.Remove(id); } } } } } /* this lock is not necessary */ //lock( _watching_regions ) { _watching_regions = rs; } }
public void NullValuesRejected() { var list = new RepeatedField<string>(); Assert.Throws<ArgumentNullException>(() => list.Add((string)null)); Assert.Throws<ArgumentNullException>(() => list.Add((IEnumerable<string>)null)); Assert.Throws<ArgumentNullException>(() => list.Add((RepeatedField<string>)null)); Assert.Throws<ArgumentNullException>(() => list.Contains(null)); Assert.Throws<ArgumentNullException>(() => list.IndexOf(null)); }
public bool RegionIsWatched(Region ri) { bool watched = false; /* this lock is not necessary */ //lock( _watching_regions ) { watched = _watching_regions.Contains(ri); } return(watched); }
private void wizardPage4_Initialize(object sender, WizardPageInitEventArgs e) { Task.Run(async() => { if (!tutState.Contains(TutorialState.AvatarSelection)) { int gender = rdoMale.Checked ? 0 : 1; var avatarRes = await session.Client.Player.SetAvatar(new PlayerAvatar() { Backpack = 0, Eyes = 0, Avatar = gender, Hair = 0, Hat = 0, Pants = 0, Shirt = 0, Shoes = 0, Skin = 0 }); if (avatarRes.Status == SetAvatarResponse.Types.Status.AvatarAlreadySet || avatarRes.Status == SetAvatarResponse.Types.Status.Success) { encounterTutorialCompleteResponse = session.Client.Misc .MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.AvatarSelection }).Result; if (encounterTutorialCompleteResponse.Result == EncounterTutorialCompleteResponse.Types.Result.Success) { session.EventDispatcher.Send(new NoticeEvent() { Message = $"Selected your avatar, now you are {gender}!" }); this.Invoke(new Action(() => { wizardControl1.NextPage(); }), null); return(true); } } this.Invoke(new Action(() => { lblNameError.Text = "Error selecting avatar gender!"; lblNameError.Visible = true; wizardControl1.PreviousPage(); })); } return(true); }); }
private void SelectTutorialScreen(RepeatedField <TutorialState> tutorialState) { HideAllScreens?.Invoke(this, null); if (!tutorialState.Contains(TutorialState.LegalScreen)) { currentState = TutorialState.LegalScreen; LegalCommsCheck = true; RaisePropertyChanged(nameof(LegalCommsCheck)); ShowLegalScreen?.Invoke(this, null); return; } if (!tutorialState.Contains(TutorialState.AvatarSelection)) { currentState = TutorialState.AvatarSelection; ShowSelectAvatarScreen?.Invoke(this, null); return; } if (!tutorialState.Contains(TutorialState.PokemonCapture)) { currentState = TutorialState.PokemonCapture; ShowPokemonCaptureScreen?.Invoke(this, null); return; } if (!tutorialState.Contains(TutorialState.NameSelection)) { currentState = TutorialState.NameSelection; ShowNameSelectionScreen?.Invoke(this, null); return; } if (!tutorialState.Contains(TutorialState.FirstTimeExperienceComplete)) { currentState = TutorialState.FirstTimeExperienceComplete; ShowItsTimeToWalkScreen?.Invoke(this, null); return; } currentState = TutorialState.PokestopTutorial; }
//获取并设置默认亲友圈信息 public async Task SetDefaultSelectFriendsCircle(int frienCircleId = 0) { if (!AlreadyJoinFrienCircleIds.Contains(frienCircleId)) { if (AlreadyJoinFrienCircleIds.Count <= 0) { return; } frienCircleId = AlreadyJoinFrienCircleIds[0]; } CuurSelectFriendsCircle = await GetFriendsCircleInfo(frienCircleId); CreateUser = await UserComponent.Ins.GetUserInfo(CuurSelectFriendsCircle.CreateUserId); }
//如果是匹配模式 并且有AI参与 public static RepeatedField <RepeatedField <int> > AIDealCards(int number) { RepeatedField <RepeatedField <int> > distrbuteCards = new RepeatedField <RepeatedField <int> >(); RepeatedField <int> initCards = new RepeatedField <int>() { mInitCards }; //获取必赢的牌 RepeatedField <int> sureWinCards = new RepeatedField <int>(); for (int i = 0; i < 4; i++) { int shunZiStart = RandomTool.Random(1, 17); while (shunZiStart == 8 || shunZiStart == 9) { shunZiStart = RandomTool.Random(1, 17); } for (int j = 0; j < 3; j++) { sureWinCards.Add(shunZiStart + j); initCards.Remove(shunZiStart + j); } } int jiangNum = RandomTool.Random(1, 22); while (sureWinCards.Contains(jiangNum)) { jiangNum = RandomTool.Random(1, 22); } sureWinCards.Add(jiangNum); sureWinCards.Add(jiangNum); initCards.Remove(jiangNum); initCards.Remove(jiangNum); int winCardIndex = RandomTool.Random(0, sureWinCards.Count); int winCard = sureWinCards[winCardIndex]; sureWinCards.Remove(winCard); sureWinCards.Add(winCard); //将牌打乱获取正常玩家的牌 initCards.RandomBrakRank(); for (int i = 0; i < number; i++) { distrbuteCards.Add(initCards.TakeOutCards(DealCardCount)); } initCards.AddRange(sureWinCards); distrbuteCards.Add(initCards); return(distrbuteCards); }
public RepeatedField <AwardPB> GetStarRoadRewardPBByCount(int count, PlayerPB player, ref int weight, RepeatedField <int> list) { foreach (var v in StarRoadRewardRulePbs) { if (v.Player == player) { if (list == null && v.Weight >= count) { weight = v.Weight; return(v.Awards); } else if (list != null && !list.Contains(v.Weight)) { weight = v.Weight; return(v.Awards); } } } Debug.LogError("No Such PB"); return(null); }
public AccumulativeRechargeVO(ActivityAccumulativeRechargeRulePB pb, RepeatedField <int> ReceiveIds, int rechargeNum) { GearId = pb.GearId; ActivityId = pb.ActivityId; GearAmound = pb.GearAmount; Awards = pb.Awards; CurAmount = rechargeNum; if (ReceiveIds.Contains(GearId) && rechargeNum >= GearAmound) { //已经领取 Weight = 0; } else if (rechargeNum < GearAmound) { //不可领取 Weight = 1; } else { //可领取 Weight = 2; } }
public static async Task CompleteTutorial(Session session, RepeatedField <TutorialState> tutorialState) { var random = new TRandom(); if (!tutorialState.Contains(0)) { await Task.Delay(random.Next(1000, 5000)); var mtcReq = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.MarkTutorialComplete, RequestMessage = new MarkTutorialCompleteMessage { SendMarketingEmails = false, SendPushNotifications = false }.ToByteString() }); var mtcResp = MarkTutorialCompleteResponse.Parser.ParseFrom(mtcReq); // Form1.Logger.Debug($"Sending 0 tutorials_completed for {session.Player.Data.Username}."); } if (!tutorialState.Contains((TutorialState)1)) { await Task.Delay(random.Next(5000, 12000)); var caReq = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.SetAvatar, RequestMessage = new SetAvatarMessage { PlayerAvatar = new PlayerAvatar { Hair = random.Next(1, 5), Shirt = random.Next(1, 3), Pants = random.Next(1, 2), Shoes = random.Next(1, 6), Avatar = random.Next(0, 1), Eyes = random.Next(1, 4), Backpack = random.Next(1, 5) } }.ToByteString() }); var caResp = SetAvatarResponse.Parser.ParseFrom(caReq); // Form1.Logger.Debug($"Sending set random player character request for ${session.Player.Data.Username}."); } await Task.Delay(random.Next(500, 600)); var gppr = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.GetPlayerProfile, RequestMessage = new GetPlayerProfileMessage { PlayerName = session.Player.Data.Username }.ToByteString() }); var gppre = GetPlayerProfileResponse.Parser.ParseFrom(gppr); // Form1.Logger.Debug($"Fetching player profile for {session.Player.Data.Username}..."); if (!tutorialState.Contains((TutorialState)3)) { await Task.Delay(random.Next(1000, 1500)); var starters = new[] { PokemonId.Bulbasaur, PokemonId.Charmander, PokemonId.Squirtle }; var starter = starters[random.Next(0, starters.Length)]; var streq = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.EncounterTutorialComplete, RequestMessage = new EncounterTutorialCompleteMessage { PokemonId = starter }.ToByteString() }); // Form1.Logger.Debug($"Catching the starter for {session.Player.Data.Username}. (Chose {starter.ToString()})"); var gpr = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.GetPlayer, RequestMessage = new GetPlayerMessage { PlayerLocale = new GetPlayerMessage.Types.PlayerLocale { Country = "US", Language = "en", Timezone = "America/New_York" } }.ToByteString() }); var gpre = GetPlayerResponse.Parser.ParseFrom(gpr); } if (!tutorialState.Contains((TutorialState)4)) { await Task.Delay(random.Next(5000, 12000)); var ccreq = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.ClaimCodename, RequestMessage = new ClaimCodenameMessage { Codename = session.Player.Data.Username }.ToByteString() }); var ccres = ClaimCodenameResponse.Parser.ParseFrom(ccreq); // Form1.Logger.Debug($"Claimed codename for {session.Player.Data.Username}."); var gpr = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.GetPlayer, RequestMessage = new GetPlayerMessage { PlayerLocale = new GetPlayerMessage.Types.PlayerLocale { Country = "US", Language = "en", Timezone = "America/New_York" } }.ToByteString() }); var gpre = GetPlayerResponse.Parser.ParseFrom(gpr); } var firstOrDefault = session.Player.Inventory.InventoryItems.Select(i => i.InventoryItemData?.PokemonData).FirstOrDefault(p => p != null && p.PokemonId > 0); if (firstOrDefault != null) { var starterId = firstOrDefault.Id; if (starterId != null) { var budreq = await session.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.SetBuddyPokemon, RequestMessage = new SetBuddyPokemonMessage { PokemonId = starterId }.ToByteString() }); var budres = SetBuddyPokemonResponse.Parser.ParseFrom(budreq); // Form1.Logger.Debug($"Setting buddy pokemon for {session.Player.Data.Username}."); } } // Form1.Logger.Info($"And {session.Player.Data.Username} is done. Waiting a sec to avoid throttle."); await Task.Delay(random.Next(2000, 4000)); }
public bool Contains(T item) { return(_internal.Contains(item)); }
public GrowthFunVo(GrowthFundRulePB pb, RepeatedField <int> awardlist) { Id = pb.Id; DepartmentLevel = pb.DepartmentLevel; AwardPbs = pb.Awards; // Debug.LogError(pb.DepartmentLevel+" "+GlobalData.PlayerModel.PlayerVo.Level+" "+awardlist.Contains(Id)); if (pb.DepartmentLevel <= GlobalData.PlayerModel.PlayerVo.Level && awardlist != null && awardlist.Contains(Id)) { //已经领取 Weight = 0; } else if (pb.DepartmentLevel > GlobalData.PlayerModel.PlayerVo.Level)//|| { //不能领取 Weight = 1; } else { //可领取 Weight = 2; } }
public void IList_Contains() { IList list = new RepeatedField<string> { "first", "second" }; Assert.IsTrue(list.Contains("second")); Assert.IsFalse(list.Contains("third")); Assert.IsFalse(list.Contains(new object())); }
/* public Unit GetUnitFromTag(ulong tag) * { * foreach(Unit u in allUnits) * { * if(u.Tag == tag) * { * return u; * } * } * return null; * }*/ public virtual bool IsUpgraded(UPGRADE_ID upgrade) { return(upgradeIDs.Contains((uint)upgrade)); }