public void EnableGameTool(GameTools tool, bool value) { Button button = buttons[tool]; button.interactable = value; float alpha = value ? 1 : 0.5f; button.transform.Find("Image").GetComponent<Image>().color = new Color(1, 1, 1, alpha); }
public virtual MahjongItem OnThrowCard(int value) { YxDebug.Log(string.Format("玩家{0}打出一张牌{1}", UserInfo.name, (EnumMahjongValue)value)); LostToken(); var item = GetHandCard(value); if (IsOther) { HandCardList.Remove(0); } else { HandCardList.Remove(value); } MahjongEnv.ThrowOutCard(item); SortHandCard(); Facade.Instance <MusicManager>().Play(GameTools.GetOperationVoice(UserInfo.Sex, value.ToString(), 0)); YxDebug.Log("打牌飞起状态"); return(item); }
protected override Variant _formatConfig(Variant conf) { SkillConf.instance = this; bool flag = conf.ContainsKey("skill"); if (flag) { conf["skill"] = GameTools.array2Map(conf["skill"], "id", 1u); Variant variant = conf["skill"]; foreach (Variant current in variant.Values) { bool flag2 = current.ContainsKey("Level"); if (flag2) { current["Level"] = GameTools.array2Map(current["Level"], "level", 1u); } } } return(conf); }
public Variant get_npc_data(int npcid) { if (m_conf == null || !m_conf["npc"].ContainsKey(npcid.ToString())) { GameTools.PrintError("get_npc_data [" + npcid + "] Config Err!"); return(null); } Variant npcData = m_conf["npc"][npcid.ToString()]; if (npcData == null) { GameTools.PrintError("get_npc_data npc[" + npcid + "] not exist Err!"); return(null); } if (npcData.ContainsKey("name")) { npcData["name"] = LanguagePack.getLanguageText("npcName", npcid.ToString()); } return(npcData); }
public void ReleaseSkill(int skillID, DefAction OnSuccess = null, DefAction OnFinish = null, DefAction OnFail = null) { GameTools.Log("ReleaseSkill"); SkillItem skill = GetSkillItemBySkillID(skillID); if (skill == null || !isAbleReleaseSkill()) { if (OnFail != null) { OnFail(); } return; } SkillBase skillCtrl = GetSkillCtrlBySkillID(skillID); if (skillCtrl != null) { skillCtrl.Release(OnSuccess, OnFinish); } }
private void OnClickChiG(GameObject button) { int clickNum = int.Parse(button.name); int[] finalChi = GetChiGpcards(ChiGroup[clickNum]); // 获得组合吃的那两张牌 YxDebug.Log(string.Format("用来吃的牌是:{0}", (EnumMahjongValue)CheckCard)); foreach (var chiitem in finalChi) { YxDebug.Log((EnumMahjongValue)chiitem); } YxDebug.Log("吃的牌是:" + (EnumMahjongValue)CheckCard); ClearMenu(); SFSObject request = GameTools.getSFSObject((int)EnumRequest.CPHType); request.PutInt(RequestKey.KeyTypeType, (int)EnumCpgType.Chi); request.PutInt(RequestKey.KeyOpCard, CheckCard); request.PutIntArray(RequestKey.KeyCards, finalChi); SendRequest(request); ShowChiPaiInfo.Instance.Show(false); }
private void _linedata_invalid() { long timer = GameTools.getTimer(); bool flag = timer - this._req_line_sttm > 300000L; if (flag) { this._is_linedata_invalid = true; this._req_line_sttm = GameTools.getTimer(); } TZDate tZDate = new TZDate((double)timer); TZDate tZDate2 = new TZDate((double)this._last_req_tm); bool flag2 = tZDate.date != tZDate2.date; if (flag2) { this._is_linedata_invalid = true; this.GetLineData(); } }
protected void dynamicAniProcess() { float num = (float)GameTools.getTimer(); for (int i = this._showDynArr.Count - 1; i >= 0; i--) { Variant variant = this._showDynArr[i]; bool flag = num > variant["etm"]._float; if (flag) { this._dynamicSpr.removeChild((variant["spr"]._val as _graphChaSprite).dispObj, false); (variant["spr"]._val as _graphChaSprite).dispose(); this._showDynArr.RemoveAt(i); } else { this._dynamicAniFun[variant["conf"]["tp"]._int](num, variant); } } }
private void ReleaseAttack03(DefAction OnFinish) { WaitForSec(0.5f, () => { AudioManager.Instance.PlayAudio(AudioManager.Man_Comm_Attack03); }); GameTools.LogError("ReleaseAttack0333"); animMgr.PlayClip(attack03Clip, () => { OnReleaseFinish(OnFinish); }); WaitForSec(DelayCalAttack03DamageTime, () => { AttackItem attack = new AttackItem(); attack.Damage = Damage * 3; attack.Type = AttackType.Normal; attack.Stage = AttackStage.Third; attack.AttackDir = AttackDir.Forward; PlayerFightCtrl.Instance.CalculateDamage(attack); }); }
protected override void onKeyProcess(float elapsedTime) { if (mGameInputManager.getKeyCurrentDown(KeyCode.A)) { LayoutTools.UNLOAD_LAYOUT(LAYOUT_TYPE.LT_BUTTOM_PROMPT); CommandGameSceneManagerEnter cmd = newCmd(out cmd); cmd.mSceneType = GAME_SCENE_TYPE.GST_MAIN; pushCommand(cmd, mGameSceneManager); GameTools.PLAY_AUDIO_UI(mScriptGlobalAudio.getAudioWindow(), SOUND_DEFINE.SD_CLICK_BUTTON); return; } if (mGameInputManager.getKeyCurrentDown(KeyCode.Y)) { CommandGameSceneChangeProcedure cmd = newCmd(out cmd); cmd.mProcedure = PROCEDURE_TYPE.PT_START_SELECT_TRACK; pushCommand(cmd, mGameScene); GameTools.PLAY_AUDIO_UI(mScriptGlobalAudio.getAudioWindow(), SOUND_DEFINE.SD_CLICK_BUTTON); return; } }
public override void enter(StateParam param) { mTurbo = mObjectManager.createObject(mPlayer.getObject(), GameDefine.R_PARTICLE_PREFAB_PATH + GameDefine.TURBO); mTurbo.name = "Turbo"; mTurbo.transform.localPosition = new Vector3(0.5f, -3.0f, 2.0f); float speed = mPlayer.getCharacterData().mSpeed; CommandCharacterHardwareSpeed cmd = newCmd(out cmd); cmd.mSpeed = speed + GameUtility.getSprintIncreaseSpeed(speed); cmd.mExternalSpeed = false; pushCommand(cmd, mPlayer); // 提升加速度,加速度会自动恢复到正常值 CharacterSpeedHardware component = mPlayer.getFirstComponent <CharacterSpeedHardware>(); component.setAcceleration(50.0f); if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF)) { GameTools.PLAY_AUDIO_UI(mScriptGlobalAudio.getAudioWindow(), SOUND_DEFINE.SD_SPRINT); } }
// Update is called once per frame void Update() { if (isResult) { return; } if (PlayerFightCtrl.Instance.isDie) { GameTools.Log("Lose"); UITools.D("FightResult").CallLuaMethod("Show", false); isResult = true; } if (EnemyManager.Instance.isOver()) { GameTools.Log("Win"); UITools.D("FightResult").CallLuaMethod("Show", true); isResult = true; } }
public void OnUserTalk(ISFSObject param) { int seat; int index; string text; string strTalk; GameTools.TryGetValueWitheKey(param, out seat, RequestKey.KeySeat); MahjongPlayer[] players = App.GetGameManager <Mahjong2DGameManager>().Players; if (players == null || players.Length == 0 || players[seat] == null) { return; } int type; GameTools.TryGetValueWitheKey(param, out type, RequestKey.KeyType); switch (type) { case 0: string str; GameTools.TryGetValueWitheKey(param, out text, RequestKey.KeyText); if (text.Contains(_conmonTag)) { int commonIndex = int.Parse(text.Replace(_conmonTag, null)); str = CommonSpeakStrings[commonIndex]; Facade.Instance <MusicManager>().Play(GameTools.GetNormalTalkVoice(players[seat].UserInfo.Sex, commonIndex)); } else { str = text; } players[seat].CurrentInfoPanel.ShowTalkContent(str); break; case 1: GameTools.TryGetValueWitheKey(param, out index, RequestKey.KeyExp); players[seat].CurrentInfoPanel.ShowPhizContent(index); break; } }
public override void use(CharacterOther player) { // 在角色当前位置放置一个地雷 Vector3 curRot = player.getRotation(); Vector3 dir = MathUtility.getVectorFromAngle(curRot.y * Mathf.Deg2Rad); Vector3 pos = player.getPosition() - dir * 2.0f; LandmineParam param = new LandmineParam(); param.mPosition = pos; SceneLandMine landmine = mItemManager.createItem <SceneLandMine>(SCENE_ITEM.SI_LAND_MINE, param); if (player.isType(CHARACTER_TYPE.CT_MYSELF)) { GameTools.PLAY_AUDIO_OBJECT(landmine, SOUND_DEFINE.SD_PUT_LANDMINE); } // 使用后立即移除背包中的道具 CommandCharacterRemoveItem cmdRemove = newCmd(out cmdRemove); cmdRemove.mItem = this; pushCommand(cmdRemove, player); }
/// <summary> /// 船移动到桥边 /// </summary> public void ChuanMove2() { GameTools.WaitDoSomeThing(this, 2.1f, () => { GameTools.FadeUI(tipUI, true, 1.3f); transform.DOLocalMoveX(17.5f, 4.5f).SetEase(Ease.InOutSine).OnComplete(() => { player.transform.SetParent(null); player._PlayerState = PlayerState.Walk; player.transform.DOBlendableLocalMoveBy(Vector3.right * 1.5f, 1f).SetEase(Ease.Linear).OnComplete(() => { player._PlayerState = PlayerState.Idle; PlayerController.isLock = false; }); }); }); if (OnChuanMove2 != null) { OnChuanMove2.Invoke(); } }
protected override void onKeyProcess(float elapsedTime) { if (mGameInputManager.getKeyCurrentDown(KeyCode.X)) { // 准备在0.5秒之后跳转到选择角色流程 CommandGameScenePrepareChangeProcedure cmd = newCmd(out cmd); cmd.mProcedure = mGameScene.getLastProcedureType(); cmd.mPrepareTime = 0.5f; pushCommand(cmd, mGameScene); GameTools.PLAY_AUDIO_UI(mScriptGlobalAudio.getAudioWindow(), SOUND_DEFINE.SD_CLICK_BUTTON); return; } if (mGameInputManager.getKeyDown(KeyCode.A)) { setVolume(mGameSetting.getCurVolume() + 0.01f); } if (mGameInputManager.getKeyDown(KeyCode.B)) { setVolume(mGameSetting.getCurVolume() - 0.01f); } }
public void SetUserOverData(ISFSObject ob) { ISFSArray users; long time; int ownerId; GameTools.TryGetValueWitheKey(ob, out _ownerName, RequestKey.KeyOwnerName); GameTools.TryGetValueWitheKey(ob, out users, RequestKey.KeyUsers); GameTools.TryGetValueWitheKey(ob, out time, RequestCmd.ServerTime); GameTools.TryGetValueWitheKey(ob, out ownerId, RequestKey.KeyOwnerId); if (time.Equals(0)) { _nowDateTime = DateTime.Now; } else { _nowDateTime = GameTools.GetSvtTime(time); YxDebug.LogError("服务器返回的结束时间是"); } CheckResultInfo(users, ownerId); }
/// <summary> /// 点击旋风杠之后的桌面显示(菜单) /// </summary> public void OnXuanFengGangClick() { _specialGangList.Clear(); int laiZiNum = App.GetGameManager <Mahjong2DGameManager>().LaiZiNum; TryAddFengList(ConstantData.XfgFour, laiZiNum); TryAddFengList(ConstantData.XfgThree, laiZiNum); if (_specialGangList.Count == 1) { SFSObject request = GameTools.getSFSObject((int)EnumRequest.XFG); request.PutIntArray(RequestKey.KeyCards, _specialGangList[0]); SendRequest(request); _specialGangList.Remove(_specialGangList[0]); ShowGangPaiInfo.Instance.Show(false); ClearMenu(); } else { ShowSpecialGangInfo.Instance.ShowSpecialGang(_specialGangList, OnClickXfg); } }
public ResultInfoData(ISFSObject data, List <int> handCards) { _data = data; ISFSArray Groups; FenZhangCard = 0; GameTools.TryGetValueWitheKey(data, out HuType, RequestKey.KeyType); GameTools.TryGetValueWitheKey(data, out HuNumber, RequestKey.KeyHuNum); GameTools.TryGetValueWitheKey(data, out GangNum, RequestKey.KeyGangNum); GameTools.TryGetValueWitheKey(data, out FanName, RequestKey.KeyHuName); GameTools.TryGetValueWitheKey(data, out NowRoundScore, RequestKey.KeyGold); GameTools.TryGetValueWitheKey(data, out TotalGold, RequestKey.KeyTotalGold); GameTools.TryGetValueWitheKey(data, out Groups, RequestKey.KeyGroups); GameTools.TryGetValueWitheKey(data, out UserSeat, RequestKey.KeySeat); GameTools.TryGetValueWitheKey(data, out GuoDanSocre, RequestKey.KeyDanScore); GameTools.TryGetValueWitheKey(data, out QingFengScore, RequestKey.KeyQingfengScore); IsWiner = HuType > 0; IsZimo = HuType.Equals(2); HandList = handCards; MahjongGroups = GameTools.GetGroupData(Groups); }
public void get_value(string id, Action onfin) { resolve(id); if (!m_map.ContainsKey(id)) { GameTools.PrintCrash("map grd file load err!"); onfin(); return; } List <string> l = m_map[id]; dataGrd(l[0], () => { dataHdt(l[1], () => { onfin(); }); }); }
public override void Prepare() { hit_time += Time.deltaTime; //按下左键 准备技能 if (Input.GetMouseButtonDown(0)) { if (!GameTools.isPointUI()) { ready(); } } //左键按下中 如果够0.3秒则显示技能范围 if (Input.GetMouseButton(0)) { if (!isStart) { return; } show_jineng(); } }
protected override void _onProcess() { LGGDMails g_mailsCT = ((this.session as ClientSession).g_mgr.g_gameM as muLGClient).g_mailsCT; bool flag = this.msgData["res"] == 1; if (flag) { g_mailsCT.getMailItem(this.msgData["id"]); } else { string languageText = LanguagePack.getLanguageText("mail", "receiveFail"); LGIUIMainUI lGIUIMainUI = (this.session as ClientSession).g_mgr.g_uiM.getLGUI("LGUIMainUIImpl") as LGIUIMainUI; lGIUIMainUI.systemmsg(GameTools.createGroup(new Variant[] { "0", languageText }), 1024u); ((this.session as ClientSession).g_mgr.g_uiM.getLGUI("LGUIMainUIImpl") as LGUIMainUIImpl_NEED_REMOVE).output_server_err(this.msgData["res"]); } }
static public Variant GetTmchkAbs(string date) { if ("" == date || null == date) { return(null); } Variant tba = GameTools.split(date, " "); Variant tby = GameTools.split(tba[0], "-"); Variant tbt = GameTools.split(tba[1], ":"); Variant ret = new Variant(); ret["y"] = (int)(tby[0]); ret["mon"] = (int)(tby[1]); ret["d"] = (int)(tby[2]); ret["h"] = (int)(tbt[0]); ret["min"] = (int)(tbt[1]); ret["s"] = (int)(tbt[2]); return(ret); }
public uint get_npc_map_id(uint npc_id) { bool flag = this._npc_in_map_id == null; if (flag) { this._npc_in_map_id = new Variant(); bool flag2 = this._mapConfs != null && this._mapConfs.Count > 0; if (flag2) { foreach (Variant current in this._mapConfs.Values) { uint @uint = current["id"]._uint; bool flag3 = !current.ContainsKey("n"); if (!flag3) { Variant variant = current["n"]; foreach (Variant current2 in variant._arr) { uint uint2 = current2["nid"]._uint; this._npc_in_map_id[uint2.ToString()] = @uint; } } } } } bool flag4 = this._npc_in_map_id.ContainsKey(npc_id.ToString()); uint result; if (flag4) { result = this._npc_in_map_id[npc_id.ToString()]; } else { GameTools.PrintError("get_npc_map_id npc[" + npc_id + "] not Exist!"); result = 0u; } return(result); }
public void DealGroupData(List <List <int> > groupData) { if (GroupPile) { var count = groupData[0].Count; switch (count) { case 3: GroupPile.Layout.maxPerLine = 5; GroupPile.Layout.Width = 190; GroupPile.transform.localPosition = new Vector3(70, 0, 0); break; case 4: GroupPile.Layout.maxPerLine = 4; GroupPile.Layout.Width = 250; GroupPile.transform.localPosition = new Vector3(15, 0, 0); break; } GroupPile.ResetPile(); foreach (var group in groupData) { MahjongGroupData data = new MahjongGroupData(GroupType.Other); data.values = group.ToArray(); var mahJongList = new List <MahjongItem>(); for (int i = 0; i < group.Count; i++) { mahJongList.Add(GameTools.CreateMahjong(group[i], false).GetComponent <MahjongItem>()); } var groupItem = GroupPile.AddGroup(data, mahJongList, false); BoxCollider box = groupItem.gameObject.AddComponent <BoxCollider>(); box.size = new Vector3(GroupPile.Layout.Width, GroupPile.Layout.Height); box.center = new Vector3(GroupPile.Layout.Width / 3, 0); UIEventListener.Get(groupItem.gameObject).onClick = OnGroupItemClick; } var bound = GroupPile.Layout.GetLayoutBounds(); CardsBg.width = (int)(bound.x + BgBaseBounds.x); CardsBg.height = (int)(bound.y + BgBaseBounds.y); } }
void Start() { int i = 0, j = 0; //物品数量应该由外部传入,这里我用随机数代替,Random.Range包前不包后,也就是随机值为1~15 int itemCount = Random.Range(1, 16); //横向的数量 int horizontalCount = Mathf.Min(itemCount, 5); //纵向的数量 int verticalCount = Mathf.Min(Mathf.CeilToInt(itemCount / 5f), 3); for (int k = 0; k < itemCount; k++) { //计算X轴的偏移 int valueX = (i * (cellWidth + Spacing)) - (horizontalCount - 1) * (cellWidth + Spacing) / 2; //计算Y轴的偏移 int valueY = (j * (cellHeight + Spacing)) - (verticalCount - 1) * (cellHeight + Spacing) / 2; //实例化对象并设置名称和坐标 GameObject go = GameTools.AddChild(transform, _prefab); go.name = "Item" + k; //下面的Y值取反,是因为顺着Y轴方向向下,数值减小 go.transform.localPosition = new Vector3(valueX, -valueY, 0); //这里主要判断当一行图标排满5个时,使其换行 if (++i == 5) { i = 0; j++; } //下面的这几句跟布局无关,就是做缓动效果的 //缓动 透明度 CanvasGroup icon = go.GetComponent <CanvasGroup>(); icon.alpha = 0; icon.DOFade(1, _time).SetDelay(k * 0.1f); //缓动 缩放 icon.transform.localScale = Vector3.one * 0.5f; icon.transform.DOScale(1, _time).SetDelay(k * 0.1f); } //动态改变背景框的大小 _border.sizeDelta = new Vector2(horizontalCount * cellWidth + 20, verticalCount * cellHeight + 20); }
/// <summary> /// 重连 /// </summary> /// <param name="data"></param> public virtual bool OnReJoin(ISFSObject data) { #region Data ISFSArray groups; int[] outCards; int[] handCards; int handNum; bool hasTing; GameTools.TryGetValueWitheKey(data, out groups, RequestKey.KeyGroups); GameTools.TryGetValueWitheKey(data, out outCards, RequestKey.KeyOutCards); GameTools.TryGetValueWitheKey(data, out handCards, RequestKey.KeyHandCards); GameTools.TryGetValueWitheKey(data, out handNum, RequestKey.KeyHandCardsNum); GameTools.TryGetValueWitheKey(data, out hasTing, RequestKey.KeyHasTing); HasTing = hasTing; GroupItems = new List <MahjongGroupData>(); ThrowOutCards = new List <int>(); GroupItems.AddRange(GameTools.GetGroupData(groups)); ThrowOutCards.AddRange(outCards.ToList()); if (handCards.Length.Equals(0)) { handCards = new int[handNum]; } HandCardList = handCards.ToList(); #endregion #region UI MahjongEnv.AddOutCards(ThrowOutCards); for (int i = 0, lenth = GroupItems.Count; i < lenth; i++) { MahjongEnv.AddGroup(GroupItems[i], null, IsOther); } AddHandCards(HandCardList); if (hasTing) { ShowTingWithEffect(false); } ShowAutoOnRejoin(UserInfo.IsAuto); return(UserInfo.IsAuto); #endregion }
protected void update_lvlcnt(int ltpid, int lvlcnt) { bool flag = !this._vipData.ContainsKey("vip_data") || this._vipData["vip_data"] == null; if (flag) { this._vipData["vip_data"] = new Variant(); } bool flag2 = this._vipData["vip_data"]["lvlcnt"] == null; if (flag2) { this._vipData["vip_data"]["lvlcnt"] = GameTools.createGroup(new Variant[] { "ltpid", ltpid, "cnt", lvlcnt }); } else { foreach (Variant current in this._vipData["vip_data"]["lvlcnt"]._arr) { bool flag3 = current["ltpid"]._int == ltpid; if (flag3) { current["cnt"] = lvlcnt; return; } } this._vipData["vip_data"]["lvlcnt"]._arr.Add(GameTools.createGroup(new Variant[] { "", ltpid, "cnt", lvlcnt })); } }
/// <summary> /// 设置gps信息 /// </summary> /// <param name="userData"></param> public void SetGpsData(ISFSObject userData) { //获取gpsx; gpsy if ((userData.ContainsKey(RequestKey.KeyGpsX) && userData.ContainsKey(RequestKey.KeyGpsY)) || (userData.ContainsKey("x") && userData.ContainsKey("y"))) { GpsX = userData.ContainsKey(RequestKey.KeyGpsX) ? userData.GetFloat(RequestKey.KeyGpsX) : userData.GetFloat("x"); GpsY = userData.ContainsKey(RequestKey.KeyGpsY) ? userData.GetFloat(RequestKey.KeyGpsY) : userData.GetFloat("y"); IsHasGpsInfo = true; } else { GpsX = -1f; GpsY = -1f; IsHasGpsInfo = false; } GameTools.TryGetValueWitheKey(userData, out Country, RequestKey.Country); }
public void OnJueClick() { YxDebug.Log("绝杠"); ClearMenu(); CheckCard = App.GetGameManager <Mahjong2DGameManager>().FanNum; ISFSObject data; if (HasToken) { data = GameTools.getSFSObject((int)EnumRequest.JueGang); data.PutInt(RequestKey.KeyOpCard, CheckCard); data.PutIntArray(RequestKey.KeyCards, new[] { CheckCard, CheckCard, CheckCard }); } else { data = GameTools.getSFSObject((int)EnumRequest.CPHType); data.PutIntArray(RequestKey.KeyCards, new[] { CheckCard, CheckCard }); data.PutInt(RequestKey.KeyTypeType, (int)EnumCpgType.Peng); data.PutInt(RequestKey.KeyOpCard, CheckCard); } SendRequest(data, false); }
private void switchFunc(GameEvent e) { Variant data = e.data; bool flag = data.ContainsKey("case"); if (flag) { string str = data["case"]._str; if (!(str == "on_arena_res")) { GameTools.PrintNotice("switchFunc defanult"); } else { this.on_arena_res(data["data"]); } } else { GameTools.PrintNotice("switchFunc no case"); } }
public void SelectGameTool(GameTools tool) { foreach(KeyValuePair<GameTools,Button> btn in buttons) { btn.Value.gameObject.GetComponent<Image>().color = Color.white; } if (tool != GameTools.NONE) { Button button = buttons[tool]; button.gameObject.GetComponent<Image>().color = Color.red; } }
private void SelectGameTool(GameTools tool) { game.tool = tool; if (tool == GameTools.NONE) { return; } DeselectSelectedEntity(); hud.SelectGameTool(tool); if (tool == GameTools.PLAY) { game.ResetGame(); } }
private void EnableGameTool(GameTools tool, bool value) { hud.EnableGameTool(tool, value); }