/// <summary> /// 播放奖励阶段音乐 /// </summary> /// <param name="type"></param> public void PlayeGameStateMusic(LSRewardType type) { var musicIndex = (int)type; switch (type) { case LSRewardType.BIG_THREE: //LSConstant.BackgroundMusic_BigThree; case LSRewardType.BIG_FOUR: //LSConstant.BackgroundMusic_BigFour; PlayVoice(LSConstant.ThreeOrFourWaring); break; case LSRewardType.NORMAL: //LSConstant.BackgroundMusci_Normal; case LSRewardType.LIGHTING: //LSConstant.BackgroundMusic_SendLamp; case LSRewardType.SENDLAMP: //LSConstant.BackgroundMusic_SendLamp; case LSRewardType.HANDSEL: //LSConstant.BackgroundMusic_Handsel; break; default: //LSConstant.BackgroundMusic_WaitBet; musicIndex = 6; YxDebug.LogError("Not exist such type music"); break; } PlayeGameStateMusic(musicIndex); }
/// <summary> /// 刷新手牌 /// </summary> /// <param name="values"></param> public virtual void RefreshHandList(List <int> values) { var items = _handPile.Layout.GetChildList(); if (items.Count != values.Count) { YxDebug.LogError("UI数量与数据数量数量不一致,去看看"); YxDebug.LogError(string.Format("玩家实际手牌数量(数据){0},目前UI数量{1}", values.Count, items.Count)); YxDebug.Log("-----------------------------------值----------------------------"); foreach (var item in values) { YxDebug.Log((EnumMahjongValue)item); } YxDebug.Log("-----------------------------------UI----------------------------"); foreach (var item in items) { YxDebug.Log((EnumMahjongValue)item.GetComponent <MahjongItem>().Value); } } for (int i = 0, lenth = items.Count; i < lenth; i++) { var item = items[i].GetComponent <MahjongItem>(); item.Value = values[i]; item.JudgeHunTag(App.GetGameManager <Lyzz2DGameManager>().LaiZiNum); } _handPile.Layout.ResetPositionNow = true; }
protected virtual void OnSuccessBind(object obj) { if (_curData != null) { if (_curData.BindInfo != null) { var data = obj as Dictionary <string, object>; var info = new ExtractBindInfo(data); if (info != null) { _curData.BindInfo = info; CallBack(_curData); } else { YxDebug.LogError("Info is null"); } } else { YxDebug.LogError("BindInfo is null"); } } else { YxDebug.LogError("_curData is null"); } Close(); }
IEnumerator ShowPlaneFit(float waitTime, PludoPlane fitPlane, AsyncCallback call = null) { yield return(new WaitForSeconds(waitTime)); var planeList = fitPlane.PlaneList.ToList(); var count = planeList.Count; YxDebug.LogError(string.Format("移动飞机的子飞机有{0}个", count)); for (int i = 0; i < count; i++) { var plane = planeList[i]; plane.PlaneListReset(); plane.PlaneData.PlaneStateChange((int)EnumPlaneStatus.Fit); plane.Hide(); _planeList.Add(plane); } if (gameObject.activeInHierarchy) { StartCoroutine(OnShowFitAction.WaitExcuteCalls()); } FreshPlaneNum(); yield return(new WaitForSeconds(FitAniTime)); if (call != null) { call(null); } }
/// <summary> /// 某个玩家打出一张牌,这个打出是到达打出位置 /// </summary> /// <param name="item"></param> /// <param name="direct"></param> /// <param name="isAuto"></param> /// <param name="moveTime"></param> public virtual void ThrowOutCard(MahjongItem item, bool direct = false, bool isAuto = false, float moveTime = 0, AsyncCallback finishCall = null) { MahjongItem newGetItem = _handPile.NewCard.GetIn;//打牌的玩家一定新抓了一张牌,放到手牌中 if (newGetItem != null) { if (item.Value != newGetItem.Value) { _handPile.AddItem(newGetItem.transform); } } else { YxDebug.LogError("获得的最后一张牌是空的,应该是谁吃碰杠"); } _handPile.NewCard.GetIn = null; if (item != null) { if (direct) { _outPile.ThrowOutCard(item, moveTime, finishCall); } else { _outPile.ThrowOutCard(item, isAuto?ThrowCardTime * AutoTimeRate:ThrowCardTime, finishCall);//找一张牌打出去 } } else { YxDebug.LogError("要打的牌是空的,什么情况?"); } }
void Update() { curretTimer += Time.deltaTime; if (curretTimer > MarqueeInterval && canMove == true) { curretImg = nImg % 24; if (nImg == resultNum) { YxDebug.LogError(result + "转的图片"); Paoma(curretImg); nImg = curretImg; resultNum = -5; canMove = false; RefeshTexts(); StartMali(); } else if (nImg < resultNum) { Paoma(curretImg); nImg++; curretTimer = 0f; } else { nImg = curretImg; } } }
public override bool OneBulletKillFish(int bulletScore, FishOddsData fishFirst) { _totalBullet += bulletScore; //鱼死亡 if (fishFirst.Odds <= 1) { YxDebug.LogError("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)"); return(false); } _current -= bulletScore; _coin -= bulletScore; int win = fishFirst.Odds * bulletScore; int winScore = _current + win; if (OutMaxScore(winScore)) { return(false); } bool kill = IsKill(fishFirst.Odds); if (kill) { _current += win; _coin += win; } return(kill); }
public void InitInfo(OverData userData) { _windner.TrySetComponentValue(userData.isYingJia); _loser.TrySetComponentValue(userData.isPaoShou); Texture tex = App.GetGameManager <Mahjong2DGameManager>().Players[userData.seat].CurrentInfoPanel.UserIcon.GetTexture(); if (tex != null) { _head.mainTexture = tex; } else { YxDebug.LogError(string.Format("设置玩家头像失败,座位号是:{0},昵称是{1}", userData.seat, userData.nick)); } _playerName.TrySetComponentValue(userData.nick); _ziMoNumber.TrySetComponentValue(userData.zimo.ToString()); _jiePaoNumber.TrySetComponentValue(userData.hu.ToString()); _dianPaoNumber.TrySetComponentValue(userData.pao.ToString()); _anGangUiLabelNumber.TrySetComponentValue(userData.anGang.ToString()); _mingGangNumber.TrySetComponentValue(userData.anGang.ToString()); _idNum.TrySetComponentValue(string.Format(IdFormat, userData.id)); _totalNumber.TrySetComponentValue(YxUtiles.GetShowNumber(userData.gold).ToString()); _houseOwner.TrySetComponentValue(userData.HouseOwner); ZeroSeatFlag.TrySetComponentValue(userData.seat == 0); }
public override void GameResponseStatus(int type, ISFSObject response) { var gdata = App.GetGameData <LswcGameData>(); YxDebug.Log("<color=green>收到了服务器返回的消息,消息类型是:" + type + "</color>"); switch (type) { case (int)LSRequestMessageType.ON_BEGIN_BET: gdata.OnNewPage(response); var gstate = gdata.GameStates; gstate.EmptyState.NextState = gstate.BetState; //LSBetState.Instance; gstate.EmptyState.Update(); break; case (int)LSRequestMessageType.ON_COLLECT_BET: App.GetRServer <LswcGameServer>().SendBetRequest(); break; case (int)LSRequestMessageType.ON_GET_RESULT: gdata.ISGetResult = true; gdata.InitNewResult(response); break; case (int)LSRequestMessageType.BET: YxDebug.LogError("下注成功"); break; } }
// Use this for initialization void Awake() { if (OddsMulti <= 0) { YxDebug.LogError("oddsMulti值得必须大于0"); } }
/// <summary> /// 发送交互信息 /// </summary> /// <param name="rt">游戏状态</param> /// <param name="data">下注金额键值对,key为gold</param> public void SendRequest(GameRequestType rt, IDictionary data) { YxDebug.Log("!!SendRequest == " + rt); if (!HasGetGameInfo) { YxDebug.LogError("GameInfo还没有初始化!!"); return; } SFSObject sfsObject = new SFSObject(); switch (rt) { case GameRequestType.UserBet: sfsObject.PutInt("gold", (int)data["gold"]); sfsObject.PutInt("seat", (int)data["seat"]); sfsObject.PutInt("type", (int)rt); break; case GameRequestType.PutCard: sfsObject.PutInt("cards", (int)data["gold"]); sfsObject.PutInt("seat", (int)data["seat"]); sfsObject.PutInt("type", (int)GameRequestType.PutCard); break; case GameRequestType.AllowStart: sfsObject.PutInt("type", (int)GameRequestType.AllowStart); break; } YxDebug.Log("发送数据:"); SendGameRequest(sfsObject); YxDebug.Log(" ----- 发送结束 ----- "); }
/// <summary> /// 开始倒计时 /// </summary> public void BeginCountDown(float time) { if (CountDown == null) { return; } if (time <= 0) { YxDebug.LogError("倒计时时间不能小于等于0!!"); return; } if (time > 150f && App.GetGameData <BlackJackGameData>().IsRoomGame) { _isCdLoop = true; time = _commonCDTime; } CountDown.fillAmount = 1f; CountDown.color = Color.green; CountDown.gameObject.SetActive(true); _cdTime = 1f / time; _cdColorTime = 2f / time; _readSecond = 0f; _isCountDown = true; CountDown.gameObject.SetActive(true); }
public Material GetColorMaterial(LSColorType type) { string materialName; switch (type) { case LSColorType.DEFAULT: materialName = LSConstant.ColorItem_Default; break; case LSColorType.GREEN: materialName = LSConstant.ColorItem_Green; break; case LSColorType.RED: materialName = LSConstant.ColorItem_Red; break; case LSColorType.YELLOW: materialName = LSConstant.ColorItem_Yellow; break; default: YxDebug.LogError("Color is not exist, name is " + type.ToString()); materialName = null; break; } return(App.GetGameManager <LswcGamemanager>().ResourseManager.GetMaterial(materialName)); }
/// <summary> /// 更新某玩家收集鱼的记录 /// </summary> /// <param name="playerIdx"></param> /// <param name="gatherIdx">收集索引</param> /// <param name="isClear">是否清空收集记录</param> void UpdatePlayerGatheredFishRecs(int playerIdx, int gatherIdx, bool isClear) { if (PlayerGatheredFish[playerIdx] == null) { YxDebug.LogError(string.Format("[FishGather] UpdatePlayerGatheredFishRecs 更新失败.PlayerGatheredFish[{0}] 未初始化", playerIdx)); return; } if (PlayerGatheredFishRecs[playerIdx] == null) { YxDebug.LogError(string.Format("[FishGather] UpdatePlayerGatheredFishRecs 更新失败.PlayerGatheredFishRecs[{0}] 未初始化", playerIdx)); return; } if (isClear) { PlayerGatheredFish[playerIdx].Clear(); PlayerGatheredFishRecs[playerIdx].Val = 0; return; } PlayerGatheredFish[playerIdx].Add(gatherIdx, null); uint recordNew = 0; foreach (KeyValuePair <int, object> kvp in PlayerGatheredFish[playerIdx]) { recordNew |= ((uint)1 << kvp.Key); } PlayerGatheredFishRecs[playerIdx].Val = recordNew; }
public void Show() { YxDebug.LogError(" ----- --------------- Show"); bg.SetActive(true); _isShow = true; }
/// <summary> /// 玩家聊天 /// </summary> /// <param name="param"></param> public void OnUserSpeak(ISFSObject param) { var url = param.GetUtfString("url"); var seat = param.ContainsKey(RequestKey.KeySeat) ? param.GetInt("seat") : 0; var len = param.ContainsKey("len") ? param.GetInt("len") : 1; ChatSystem.DownloadRecord( url, clip => { if (clips == null) { clips = new List <TalkData>(); } clips.Add(new TalkData { Clip = clip, Seat = seat, Lenth = len }); PlayVoice(); }, err => { YxDebug.LogError("下载音频失败"); } ); }
/// <summary> /// 加入比赛 /// </summary> public void JoinMatch() { if (_curData != null) { var gameKey = _curData.GameKey; var gameType = _curData.GameType; YxDebug.LogError("加入比赛"); YxDebug.LogError(string.Format("当前比赛的游戏是:{0}房间类型是:{1}", gameKey, gameType)); var dic = GameListModel.Instance.GameUnitModels; if (dic.ContainsKey(gameKey)) { if (_curData.IsQucikGame) { OnOpenQuickGame(); } else { OnOpenCreateWindow(); } } else { YxMessageBox.Show("咋整地,没配置游戏就想比赛啊!"); } } }
/// <summary> /// 攻击 /// </summary> /// <param name="planeDataDic"></param> /// <param name="attackControl"></param> /// <param name="newPlaneData"></param> /// <param name="moveFinishCall"></param> /// <returns></returns> IEnumerator OnAttack(Dictionary <int, Dictionary <int, PludoPlaneData> > planeDataDic, PludoControl attackControl, PludoPlaneData newPlaneData, AsyncCallback moveFinishCall) { var attackPlanId = newPlaneData.DataId; var beAttackInfos = new List <BeAttackInfo>(); foreach (var planesItem in planeDataDic) { var beAttackList = new List <int>(); var key = planesItem.Key; var planesDic = planesItem.Value; var control = ControlList.Find(item => item.Seat == key); beAttackList.AddRange(from planeDicItem in planesDic select planeDicItem.Value into planeData where planeData.CheckPlaneState(EnumPlaneStatus.BeAttack) select planeData.DataId); foreach (var beAttackId in beAttackList) { var mapPos = control.PlanesDic[beAttackId].PlaneData.LocalPosition; var distance = attackControl.GetDistance(attackPlanId, mapPos); var info = new BeAttackInfo(control, beAttackId, distance); beAttackInfos.Add(info); } } Comparison <BeAttackInfo> compare = (x, y) => { return(x.Distance.CompareTo(y.Distance)); }; beAttackInfos.Sort(compare); foreach (var beAttackInfo in beAttackInfos) { YxDebug.LogError(string.Format("ID:{0};Distance:{1}", beAttackInfo.PlaneId, beAttackInfo.Distance)); yield return(new WaitForSeconds(attackControl.OnPlaneAttack(attackPlanId, beAttackInfo.Control.OnPlaneBeAttack(beAttackInfo.PlaneId)))); Facade.Instance <MusicManager>().Play(ConstantData.KeyPlaneBoom); } attackControl.WaitBoomAndMove(newPlaneData, moveFinishCall); }
protected virtual void ToSelectTingOut() { List <int> outList = Manager.TingOutCards; var tingCount = outList.Count; if (tingCount == 1) { var tingValue = outList[0]; MahjongItem selectItem = GetHandCard(tingValue); if (selectItem) { OnMahjongClick(selectItem.transform); } } else { MahjongEnv.SetHandCardsInvalid(); InteraptMenu.Instance.Revert(); InteraptMenu.Instance.ShowTing(true); for (int i = 0; i < tingCount; i++) { int checkValue = outList[i]; MahjongItem selectItem = GetHandCard(checkValue); if (selectItem != null) { selectItem.SetColor(Color.white); AddUserControl(selectItem); } else { YxDebug.LogError(string.Format("TingOut牌中的牌:{0}值是:{1},不存在于实际手牌中", (EnumMahjongValue)checkValue, checkValue)); } } } }
/// <summary> /// 飞机被攻击(包括撞机) /// </summary> /// <param name="planeId">飞机Id</param> /// <param name="widthLock"></param> /// <returns>被攻击飞机位置</returns> public Vector3 OnPlaneBeAttack(int planeId, bool widthLock = true) { var beAttackPlane = GetPlaneById(planeId); if (widthLock) { beAttackPlane.OnPlaneBeLock(); } var planeCount = beAttackPlane.PlaneList.Count; var planeList = beAttackPlane.PlaneList.ToList(); var planeMoveList = new List <MoveAndRotateData>(); for (int i = 0; i < planeCount; i++) { var plane = planeList[i]; plane.PlaneData.PlaneStateChange((int)EnumPlaneStatus.Home); GetMapPosByPlaneData(plane.PlaneData, false); MoveAndRotateData moveRotaData = new MoveAndRotateData(); moveRotaData.MovePath = new List <Vector3>(); moveRotaData.MovePath.Add(plane.PlaneData.CurPos); moveRotaData.FinishRotate = plane.PlaneData.DefTargetPos; planeMoveList.Add(moveRotaData); } if (widthLock) { YxDebug.LogError((ItemColor)CurColor + "被攻击飞机数量是:" + planeMoveList.Count); } else { YxDebug.LogError((ItemColor)CurColor + "被撞击飞机数量是:" + planeMoveList.Count); } beAttackPlane.OnPlaneBeAttack(planeMoveList, widthLock); return(beAttackPlane.LocalPosition); }
public void ShowPhiz(int index) { Show(true); if (PhizWithAni) { UIAtlas atla = AtlasManager.Instance.GetAtlaByName(string.Format(AtlasFormat, index)); if (atla != null) { _phiz.atlas = atla; UISpriteAnimation ani = _phiz.gameObject.GetComponent <UISpriteAnimation>(); ani.namePrefix = index.ToString(); ani.Play(); int phizWidth = atla.spriteList[0].width; int phizHeight = atla.spriteList[0].height; _bgSprite.width = phizWidth > _phizBgWidth ? phizWidth : _phizBgWidth; _bgSprite.height = phizHeight > _phizBgHeight ? phizHeight : _phizBgHeight; _bgSprite.gameObject.TrySetComponentValue(true); } else { YxDebug.LogError(string.Format("There is not exist such atla,name is {0}", index)); } } else { _phiz.TrySetComponentValue(string.Format(StaticPhizFormat, index)); _phiz.MakePixelPerfect(); } _phiz.gameObject.SetActive(true); DoHide(); }
protected override void DealShowData() { if (Data is Dictionary <string, object> ) { ExtractData data = new ExtractData(Data, GetType()); if (ShowArea) { var visible = data.Visible; ShowArea.SetActive(visible); if (visible) { if (Option) { _dataDic = data.DataDic; Option.Clear(); foreach (var item in data.DataDic) { Option.AddItem(item.Key); } if (Option.items.Count > 0) { var showName = Option.items[0]; Option.Set(showName); _curCostType = showName; _curCostData = _dataDic[showName] as ExtractItemData; } else { YxDebug.LogError("Extract types count is zero,please check again!"); } } } } } }
IEnumerator CardValueForStart() { if (MyCardsValueList.Count != CardItemList.Count) { YxDebug.LogError("手牌与手牌值长度不相等,手牌数为:" + CardItemList.Count + ",值的数量为:" + MyCardsValueList.Count + "手牌值为:"); } for (int i = 0; i < MyCardsValueList.Count; i++) { CardItemList[i].Value = MyCardsValueList[i]; CardItemList[i].SetCardDepth(i); yield return(new WaitForSeconds(0.005f)); } FreshHandCard(null); CardsArea.GetComponent <UIGrid>().Reposition(); if (GetInfo <JlGameUserInfo>().ActiveCards != null) { FreshHandCard(GetInfo <JlGameUserInfo>().ActiveCards); GetInfo <JlGameUserInfo>().ActiveCards = null; if (!GetInfo <JlGameUserInfo>().IsCurSpeaker) { NoCanClickCard(); } } if (GetInfo <JlGameUserInfo>().IsTrusteeship) { ShowTrusteeshipObj(true); } if (TrusteeshipObj.GetComponent <UIButton>().onClick.Count == 0) { TrusteeshipObj.GetComponent <UIButton>().onClick.Add(RejoinFresh); } }
private void OnClickListener(GameObject gob) { SpeakButton btnid = (SpeakButton)UIEventListener.Get(gob).parameter; var gserver = App.GetRServer <BlackJackGameServer>(); switch (btnid) { case SpeakButton.BuyInsurance: gserver.SendRequest(GameRequestType.Insurance); break; case SpeakButton.Double: gserver.SendRequest(GameRequestType.AddRate); break; case SpeakButton.Hit: gserver.SendRequest(GameRequestType.Hit); break; case SpeakButton.Stand: gserver.SendRequest(GameRequestType.Stand); break; default: YxDebug.LogError("No this button in you enum!!"); break; } }
private Dictionary <string, object> GetParams() { var dic = new Dictionary <string, object>(); var count = ParamKeys.Count; if (count == ParamValues.Count) { for (var i = 0; i < count; i++) { var key = ParamKeys[i]; var value = ParamValues[i].text; if (key.Equals("depositValue")) { value = YxUtiles.RecoverShowNumber(double.Parse(value)).ToString(); } if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) { continue; } dic.Add(key, value); } } else { YxDebug.LogError("ParamKeys count is not equal with "); } return(dic); }
/// <summary> /// 发送交互信息 /// </summary> /// <param name="rt"></param> /// <param name="data"></param> public void SendRequest(GameRequestType rt, IDictionary data) { YxDebug.Log("SendRequest == " + rt); if (!App.GetGameData <GangwuGameData>().IsGameInfo) { YxDebug.LogError("GameInfo还没有初始化!!"); return; } SFSObject sfsObject = new SFSObject(); switch (rt) { case GameRequestType.Bet: case GameRequestType.AdvanceBet: if (!data.Contains("gold")) { UnityEngine.Debug.LogError("没有Gold"); } sfsObject.PutInt("gold", (int)data["gold"]); sfsObject.PutInt("type", (int)rt); break; case GameRequestType.Fold: sfsObject.PutInt("type", (int)rt); break; } YxDebug.Log("发送数据:"); YxDebug.TraceSfsObject(sfsObject); SendGameRequest(sfsObject); }
IEnumerator CaptureScreenshotJpg(Rect rect, Action <string> onFinish) { yield return(new WaitForEndOfFrame()); // 先创建一个的空纹理,大小可根据实现需要来设置 var screenShot = new Texture2D((int)(rect.width), (int)(rect.height), TextureFormat.RGB24, false); // 读取屏幕像素信息并存储为纹理数据, screenShot.ReadPixels(rect, 0, 0); screenShot.Apply(); var encoder = new JPGEncoder(screenShot, 20); //质量1~100 encoder.doEncoding(); while (!encoder.isDone) { yield return(null); } File.WriteAllBytes(_sShotImgpath, encoder.GetBytes()); while (!File.Exists(_sShotImgpath)) { YxDebug.LogError("等待截图完成"); yield return(new WaitForEndOfFrame()); } onFinish(_sShotImgpath); //Share.GetInstance().ShowShareImg(tittle, content, "", _sShotImgpath, ContentType.Image); }
public float JudgeY = 0f; // 判定点 由于向上移动 故坐标点大于该值时重置为起始位置 // Use this for initialization protected void Start() { if (JudgeY.Equals(0f)) { YxDebug.LogError("------> StartVec and CenterY and JudgeLen couldn't be null in AniMoveFruit!\n"); } }
protected override void OnFreshView() { base.OnFreshView(); _curData = GetData <ExtractItemData>(); if (_curData == null) { YxDebug.LogError("_curData==========null"); return; } BindState = _curData.BindInfo.BindState; if (gameObject.activeInHierarchy) { StartCoroutine(OnBindStateShow.WaitExcuteCalls()); } var platfomName = _curData.PlatformName; platfomName = BindState ? string.Format(TitleBindStateFormat, platfomName) : string.Format(TitleUnBindStateFormat, platfomName); var btnNotice = BindState ? BtnBindStateFormat : BtnUnBindStateFormat; TitleLabel.TrySetComponentValue(platfomName); BtnLabel.TrySetComponentValue(btnNotice); if (PhoneInput != null) { var phone = _curData.BindInfo.BindPhoneNumber; PhoneInput.enabled = string.IsNullOrEmpty(phone); PhoneInput.value = phone; } }
public IEnumerator PlayAnimalAnimation(int time) { for (int i = 0; i < time; i++) { while (_animaition.isPlaying) { yield return(new WaitForEndOfFrame()); } switch (CurAnimation) { case LSAnimalAnimationType.BET: PlayBetAnimation(); break; case LSAnimalAnimationType.RAWARD: PlayRewardAnimation(); break; case LSAnimalAnimationType.WATCH: PlayWatchAnimation(); break; default: YxDebug.LogError("Not exist such animationType " + CurAnimation.ToString()); break; } } }