protected override async void Run(Session session, C2G_DailySignState message, Action <G2C_DailySignState> reply) { G2C_DailySignState response = new G2C_DailySignState(); try { // 当前连续签到天数 int curLianXuSignDays = 1; bool TodayIsSign = false; DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>(); List <DailySign> dailySigns = await proxyComponent.QueryJson <DailySign>($"{{Uid:{message.Uid}}}"); dailySigns.Sort(delegate(DailySign x, DailySign y) { return(x.CreateTime.CompareTo(y.CreateTime)); }); if (dailySigns.Count > 0) { int tianshucha = CommonUtil.tianshucha(dailySigns[dailySigns.Count - 1].CreateTime, CommonUtil.getCurTimeNormalFormat()); if (tianshucha == 0) { TodayIsSign = true; curLianXuSignDays = 1; if (dailySigns.Count >= 2) { for (int i = dailySigns.Count - 1; i >= 1; i--) { int temp = CommonUtil.tianshucha(dailySigns[i - 1].CreateTime, dailySigns[i].CreateTime); if (temp > 1) { break; } else if (temp == 1) { ++curLianXuSignDays; } } } } } { response.TodayIsSign = TodayIsSign; response.TodayReward = C2G_DailySignHandler.getReward(curLianXuSignDays); response.TomorrowReward = C2G_DailySignHandler.getReward(curLianXuSignDays + 1); reply(response); } } catch (Exception e) { ReplyError(response, e, reply); } }
public async void Awake() { ReferenceCollector rc = GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); nameTxt = rc.Get <GameObject>("NameTxt").GetComponent <Text>(); uIDTxt = rc.Get <GameObject>("UIDTxt").GetComponent <Text>(); realNameTxt = rc.Get <GameObject>("RealNameTxt").GetComponent <Text>(); noBindPhoneTxt = rc.Get <GameObject>("NoBindPhoneTxt").GetComponent <Text>(); HuafeiNumTxt = rc.Get <GameObject>("HuafeiNumTxt").GetComponent <Text>(); AlPlayTxt = rc.Get <GameObject>("AlPlayTxt").GetComponent <Text>(); WinGameTxt = rc.Get <GameObject>("WinGameTxt").GetComponent <Text>(); SuccessRateTxt = rc.Get <GameObject>("SuccessRateTxt").GetComponent <Text>(); MaxSuccessTxt = rc.Get <GameObject>("MaxSuccessTxt").GetComponent <Text>(); VipTimeTxt = rc.Get <GameObject>("VipTimeTxt").GetComponent <Text>(); returnBtn = rc.Get <GameObject>("ReturnBtn").GetComponent <Button>(); playerIcon = rc.Get <GameObject>("PlayerIcon").GetComponent <Button>(); changeNameBtn = rc.Get <GameObject>("ChangeNameBtn").GetComponent <Button>(); realNameBtn = rc.Get <GameObject>("RealNameBtn").GetComponent <Button>(); bindPhoneBtn = rc.Get <GameObject>("BindPhoneBtn").GetComponent <Button>(); ChangeAccountBtn = rc.Get <GameObject>("ChangeAccountBtn").GetComponent <Button>(); DuihuanBtn = rc.Get <GameObject>("DuihuanBtn").GetComponent <Button>(); De = rc.Get <GameObject>("De").GetComponent <Button>(); GoldNumTxt = rc.Get <GameObject>("GoldNumTxt").GetComponent <Text>(); WingNumTxt = rc.Get <GameObject>("WingNumTxt").GetComponent <Text>(); AddBtn = rc.Get <GameObject>("AddBtn").GetComponent <Button>(); DuihuanBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIUseHuaFei); }); AddBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIPlayerInfo); Game.Scene.GetComponent <UIComponent>().Create(UIType.UIShop); }); PlayerFrame = rc.Get <GameObject>("PlayerFrame"); bindPhoneBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIBindPhone); }); realNameBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIRealName); }); returnBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain).GetComponent <UIMainComponent>().SetUIHideOrOpen(true); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIPlayerInfo); if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIVIP) != null) { if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIVIP).GameObject.activeInHierarchy) { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIVIP); } } }); changeNameBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIChangeName); }); ChangeAccountBtn.onClick.Add(() => { onClickChangeAccount(); }); De.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Create(UIType.UIVIP); }); PlayerInfoComponent pc = Game.Scene.GetComponent <PlayerInfoComponent>(); PlayerInfo playerInfo = pc.GetPlayerInfo(); nameTxt.text = playerInfo.Name; uIDTxt.text = pc.uid.ToString(); AlPlayTxt.text = $"已玩牌局:{ playerInfo.TotalGameCount}"; string winRate = GameUtil.GetWinRate(playerInfo.TotalGameCount, playerInfo.WinGameCount).ToString(); if (winRate.Equals(0)) { SuccessRateTxt.text = $"胜 率:{0}%"; } else { SuccessRateTxt.text = $"胜 率:{winRate}%"; } MaxSuccessTxt.text = $"最大赢取:{playerInfo.MaxHua}"; WinGameTxt.text = $"获胜局数:{ playerInfo.WinGameCount}"; if (playerInfo.IsRealName) { realNameTxt.text = "已实名"; } if (!string.IsNullOrEmpty(playerInfo.Phone)) { noBindPhoneTxt.text = "已绑定"; } // 设置头像 { HeadManager.setHeadSprite(playerIcon.GetComponent <Image>(), PlayerInfoComponent.Instance.GetPlayerInfo().Icon); } playerIcon.onClick.Add(() => { CommonUtil.ShowUI(UIType.UIIcon); }); Init(); }
static async Task setImage(WaitSetData waitSetData) { try { Sprite sprite = null; if (waitSetData.m_head.Length < 10) { sprite = CommonUtil.getSpriteByBundle("playericon", waitSetData.m_head); } else { for (int i = 0; i < m_netHeadList.Count; i++) { if (m_netHeadList[i].m_url.CompareTo(waitSetData.m_head) == 0) { Log.Debug("使用缓存头像"); sprite = m_netHeadList[i].m_sprite; break; } } if (sprite == null) { Log.Debug("下载头像"); sprite = await CommonUtil.GetTextureFromUrl(waitSetData.m_head); m_netHeadList.Add(new NetHeadData(waitSetData.m_head, sprite)); } } if (waitSetData.m_img != null) { waitSetData.m_img.sprite = sprite; } else { Log.Debug("头像Image为空"); } { m_waitSetDataList.Remove(waitSetData); if (m_waitSetDataList.Count > 0) { await setImage(m_waitSetDataList[0]); } } } catch (Exception ex) { Log.Debug("HeadManager.setImage异常:" + ex); { m_waitSetDataList.Remove(waitSetData); if (m_waitSetDataList.Count > 0) { await setImage(m_waitSetDataList[0]); } } } }
private void Init() { if (GameUtil.isVIP()) { VipTimeTxt.text = $"过期时间:{CommonUtil.splitStr_Start_str(PlayerInfoComponent.Instance.GetPlayerInfo().VipTime, ' ')}"; } else { VipTimeTxt.text = ""; } if (OtherData.getIsShiedBindPhone()) { bindPhoneBtn.transform.localScale = Vector3.zero; } if (OtherData.getIsShiedRealName()) { realNameBtn.transform.localScale = Vector3.zero; } bindPhoneBtn.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone()); bindPhoneBtn.transform.parent.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone()); changeNameBtn.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); changeNameBtn.transform.parent.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0); realNameBtn.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameBtn.transform.parent.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName()); realNameTxt.gameObject.SetActive(!OtherData.getIsShiedRealName()); noBindPhoneTxt.gameObject.SetActive(!OtherData.getIsShiedBindPhone()); GoldNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum.ToString(); WingNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().WingNum.ToString(); HuafeiNumTxt.text = (PlayerInfoComponent.Instance.GetPlayerInfo().HuaFeiNum / 100.0f).ToString(); if (GameUtil.isVIP()) { PlayerFrame.transform.Find("HeadKuang").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "touxiangkuang_vip"); } }
public void SetRewardInfo(string spriteName, int num) { rewardItem.sprite = CommonUtil.getSpriteByBundle("image_shop", spriteName); itemNum.text = "x" + num; }
public void initData() { ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); Button_ChouJiang = rc.Get <GameObject>("Button_ChouJiang").GetComponent <Button>(); Button_close = rc.Get <GameObject>("Button_close").GetComponent <Button>(); Button_wenhao = rc.Get <GameObject>("Button_wenhao").GetComponent <Button>(); Image_bg = rc.Get <GameObject>("Image_bg"); xingyunzhi = rc.Get <GameObject>("xingyunzhi"); Item = rc.Get <GameObject>("Item"); Button_ChouJiang.onClick.Add(onClick_ChouJiang); Button_close.onClick.Add(onClickClose); Button_wenhao.onClick.Add(showGuiZe); Image_bg.transform.Find("Text_tip1/Btn_share").GetComponent <Button>().onClick.Add(onClickShare); for (int i = 0; i < ZhuanPanConfig.getInstance().getZhuanPanInfoList().Count; i++) { ZhuanPanInfo zhuanpanInfo = ZhuanPanConfig.getInstance().getZhuanPanInfoList()[i]; GameObject item = Item.transform.Find("Item_" + zhuanpanInfo.itemId).gameObject; if (zhuanpanInfo.prop_id == 1) { item.transform.Find("Image_icon").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "icon_gold"); item.transform.Find("Text_reward").GetComponent <Text>().text = ("金币" + (int)zhuanpanInfo.prop_num); } else if (zhuanpanInfo.prop_id == 3) { item.transform.Find("Image_icon").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "icon_huafei"); item.transform.Find("Text_reward").GetComponent <Text>().text = ("话费" + zhuanpanInfo.prop_num + "元"); } } if (OtherData.getIsShiedShare()) { Image_bg.transform.Find("Text_tip1").localScale = Vector3.zero; } CommonUtil.SetTextFont(Button_close.transform.parent.gameObject); UIAnimation.ShowLayer(Button_close.transform.parent.gameObject); }
public void ShowTrust() { head.sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "tuoguan_icon"); }
public static async Task GamerEnterRoom(Actor_GamerEnterRoom message) { try { //玩家还在结算画面 if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIGameResult) != null || UIRoomComponent.ISGaming) { return; } Log.Info($"收到玩家进入"); //第一次进入创建UIRoom if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom) == null) { CommonUtil.ShowUI(UIType.UIRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIMain); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UICreateFriendRoom); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIJoinRoom); } if (Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady) == null) { CommonUtil.ShowUI(UIType.UIReady); } UINetLoadingComponent.closeNetLoading(); UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom); UI uiReady = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady); GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>(); UIRoomComponent roomComponent = uiRoom.GetComponent <UIRoomComponent>(); roomComponent.ContinueGamer(); roomComponent.enterRoomMsg = message; roomComponent.SetRoomType(message.RoomType, message.Multiples); Gamer[] gamers = gamerComponent.GetAll(); //清空座位 for (int i = 0; i < gamers.Length; i++) { if (gamers[i] == null) { continue; } if (gamers[i].UserID != 0) { Log.Debug("删除gamer"); roomComponent.RemoveGamer(gamers[i].UserID); } } GamerInfo localGamer = null; for (int i = 0; i < message.Gamers.Count; i++) { if (message.Gamers[i].UserID == PlayerInfoComponent.Instance.uid) { localGamer = message.Gamers[i]; gamerComponent.LocalGamer = GamerFactory.Create(localGamer.UserID, localGamer.IsReady, localGamer.playerInfo); break; } } if (localGamer == null) { return; } roomComponent.localGamer = localGamer; //好友房处理 if (message.RoomType == 3) { UIRoomComponent.IsFriendRoom = true; roomComponent.JuCount = message.JuCount; uiReady?.GetComponent <UIReadyComponent>()?.ClosePropt(); uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(true); uiReady?.GetComponent <UIReadyComponent>()?.ShowWeChat(message.RoomId.ToString()); roomComponent.RoomConfig.Multiples = message.Multiples; roomComponent.SetFriendSetting(message.MasterUserId); if (message.CurrentJuCount > 0) { uiReady?.GetComponent <UIReadyComponent>()?.CloseBtn(); roomComponent.exitBtn.interactable = false; } } else { uiReady?.GetComponent <UIReadyComponent>()?.SetFriendRoom(false); UIRoomComponent.IsFriendRoom = false; } for (int i = 0; i < message.Gamers.Count; i++) { GamerInfo gamerInfo = message.Gamers[i]; Gamer gamer; if (gamerInfo.UserID == localGamer.UserID) { gamer = gamerComponent.LocalGamer; } else { gamer = GamerFactory.Create(gamerInfo.UserID, gamerInfo.IsReady, gamerInfo.playerInfo); } UIReadyComponent uiReadyComponent = uiReady.GetComponent <UIReadyComponent>(); GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>(); //排序 int index = gamerInfo.SeatIndex - localGamer.SeatIndex; if (index < 0) { index += 4; } //设置准备 if (uiReadyComponent != null) { if (gamer?.PlayerInfo != null) { gamerUiComponent?.SetHeadPanel(uiReadyComponent.HeadPanel[index], index); gamerUiComponent?.SetFace(roomComponent.FacePanel[index]); uiReady?.GetComponent <UIReadyComponent>()?.SetPanel(gamer, index); //根据座位的indax添加玩家 roomComponent?.AddGamer(gamer, index); } } } SoundsHelp.Instance.playSound_JinRu(); } catch (Exception e) { Log.Error(e); } }