IEnumerator _AutoBeginFight() { int cd = GameApp.Instance.GetParameter("AutoBeginFight"); while (cd > 0) { while ((GameApp.Instance.CurRoomPlayerLst.Count == 1)) { AutoBeginFightHint.gameObject.SetActive(false); cd = GameApp.Instance.GetParameter("AutoBeginFight"); yield return(new WaitForSeconds(1)); } AutoBeginFightHint.gameObject.SetActive(true); if (!PauseAutoBeginFight) { AutoBeginFightHint.text = StringBuilderTool.ToString((cd--), "秒自动开始游戏"); } if (cd <= 10) { GameApp.Instance.CommonHintDlg.OpenHintBox(AutoBeginFightHint.text); } yield return(new WaitForSeconds(1)); } OnClick_GotoFight(); }
/*public void OnClick_CompoundByMagicPower() * { * GameApp.Instance.SoundInstance.PlaySe("button"); * * GameApp.Instance.CommonMsgDlg.OpenMsgBox(StringBuilderTool.ToString("是否消耗", OutputCard.MCCfg.NeedCurrencyItemInfo.ItemCnt, "点魔力值合成", OutputCard.FullName(), "?"), * (isCompound) => * { * if (isCompound) * { * if (GameApp.Instance.MainPlayerData.MagicPower >= OutputCard.MCCfg.NeedCurrencyItemInfo.ItemCnt) * { * GameApp.Instance.MainPlayerData.MagicPower -= OutputCard.MCCfg.NeedCurrencyItemInfo.ItemCnt; * * GameApp.Instance.AddCardHoldCount(OutputCard.MCCfg.CardID, 1); * * CompoundSuccess(); * } * else * { * GameApp.Instance.CommonMsgDlg.OpenMsgBox("魔力值不足!"); * } * } * }); * }*/ public void OnClick_CompoundByCard() { GameApp.Instance.SoundInstance.PlaySe("button"); GameApp.Instance.CommonMsgDlg.OpenMsgBox(StringBuilderTool.ToString("是否消耗", OutputCard.MCCfg.NeedItemsLst.Count, "张材料卡牌合成", OutputCard.FullName(), "?"), (isCompound) => { if (isCompound) { if (GameApp.Instance.PlayerData != null) { GameApp.SendMsg.Compose(common.ComposeType.ComposeType_Item, (uint)OutputCard.MCCfg.CardID); } else { GameApp.Instance.AddCardHoldCount(OutputCard.MCCfg.CardID, 1); for (int i = 0; i < OutputCard.MCCfg.NeedItemsLst.Count; i++) { if (i < MaterialCards.Length) { GameApp.Instance.AddCardHoldCount(OutputCard.MCCfg.NeedItemsLst[i].ItemID, -1); } } CompoundSuccess(OutputCard.MCCfg.CardID); } } }); }
public void Set(MailItemInfo mii) { CurMII = mii; Name.text = mii.Name; Residue.text = StringBuilderTool.ToString(mii.Residue, "天"); if (mii.IsReadAndGet) { Bg.spriteName = "bg_yeqian_0"; if (mii.IsHasItem()) { HasItemSign.spriteName = "icon_baoxiang_0_hui"; } } else { Bg.spriteName = "bg_yeqian_2"; if (mii.IsHasItem()) { HasItemSign.spriteName = "icon_baoxiang_0"; } } LastBgSpriteName = Bg.spriteName; }
void UpdateLoginRes() { Action Over = () => { CancelInvoke("UpdateLoginRes"); GameApp.SendMsg.EndWaitUI(); }; string LoginRes = TestPlugins.Call <string>("GetLoginRes"); Debug.Log(StringBuilderTool.ToInfoString("登陆结果:", LoginRes)); string[] s = LoginRes.Split('_'); if (s.Length > 0) { switch (s[0]) { case "Wait": break; case "Success": Debug.Log("登录成功!"); Over(); SDKInfo.AccessToken = s[1]; SDKInfo.UserId = int.Parse(s[2]); SDKInfo.UserName = s[3]; Debug.Log(StringBuilderTool.ToInfoString("AccessToken:", SDKInfo.AccessToken)); Debug.Log(StringBuilderTool.ToString("UserId:", SDKInfo.UserId)); Debug.Log(StringBuilderTool.ToInfoString("UserName:", SDKInfo.UserName)); GameApp.Instance.UILogin.RecordNickName = SDKInfo.UserName; GameApp.Instance.UILogin.Account = SDKInfo.UserName; GameApp.Instance.Platform.LeSDKLogin(s[1]); break; case "NullUserInfo": GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox("登录异常!用户信息为空!"); Over(); break; case "Failure": GameApp.Instance.CommonMsgDlg.OpenSimpleMsgBox(StringBuilderTool.ToInfoString("登录失败!\n错误码:", s[1], "\n错误描述:", s[2])); Over(); break; case "Cancel": Debug.Log("取消登录!"); Over(); //清空数据,等待重新登陆... SDKInfo = new LeSDKInfo(); GameApp.Instance.Platform.PlatformInfo = new KOIPlatformInfo(); GameApp.Instance.UILogin.ShowLeSDKLogin(); break; } } }
/// <summary> 监测使用时长 </summary> static public void CheckUseDuration() { float d = 0; switch (SleepInfo.SleepInfoInstance.EnableUseDuration) { case EDuration.e15Minute: d = 15 * 60; break; case EDuration.e30Minute: d = 30 * 60; break; case EDuration.e45Minute: d = 45 * 60; break; case EDuration.e60Minute: d = 60 * 60; break; } if (Time.realtimeSinceStartup > d) { if (GameApp.Instance.HomePageUI != null) { GameApp.Instance.CommonWarningDlg.OpenWarningBox(StringBuilderTool.ToString("本次使用时长已超出设置时长(", d / 60, "分钟)")); } } }
IEnumerator RefreshAccumulativeLoginList() { string AccumulativeLoginKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin"); if (!PlayerPrefs.HasKey(AccumulativeLoginKey)) { PlayerPrefs.SetString(AccumulativeLoginKey, DateTime.Now.Ticks.ToString()); } string LastTime = PlayerPrefs.GetString(AccumulativeLoginKey); DateTime dtLastTime = new DateTime(long.Parse(LastTime)); TimeSpan ResidueTime = DateTime.Now - dtLastTime; MyTools.DestroyChildNodes(AccumulativeLoginGrid.transform); UIScrollView sv = AccumulativeLoginGrid.transform.parent.GetComponent <UIScrollView>(); for (int i = 1; i <= 31; i++) { GameObject newUnit = NGUITools.AddChild(AccumulativeLoginGrid.gameObject, AccumulativeLoginUnitPrefab); newUnit.SetActive(true); newUnit.name = "AccumulativeLoginUnit_" + i; newUnit.transform.localPosition = new Vector3(0, -140 * (i - 1), 0); UI_AccumulativeLoginUnit alu = newUnit.GetComponent <UI_AccumulativeLoginUnit>(); alu.Set(i, ResidueTime.Days + 1); sv.ResetPosition(); AccumulativeLoginGrid.repositionNow = true; yield return(new WaitForEndOfFrame()); } }
//void Start() //{ //} //void Update() //{ //} /// <summary> 设置道具数据 </summary> public void SetItemData(int itemID, int itemCount) { gameObject.SetActive(true); CsvConfigTables.Instance.ItemCsvDic.TryGetValue(itemID, out ItemCfg); if (ItemCfg != null) { if (ItemCfg.Type == 2) { Icon.enabled = false; UITexture cardIcon = Icon.gameObject.AddComponent <UITexture>(); cardIcon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", ItemCfg.GetIcon())) as Texture; cardIcon.width = 40; cardIcon.height = 60; cardIcon.depth = 14; } else { Icon.spriteName = ItemCfg.Icon; Icon.MakePixelPerfect(); } Name.text = StringBuilderTool.ToString(ItemCfg.Name, "x", itemCount); } }
IEnumerator RefreshCardList() { MyTools.DestroyChildNodes(CardTable.transform); CommodityWaitLoad.SetActive(true); int CurProg = 0; foreach (MagicCardConfig CardCfg in TempToExchangeCardLst) { GameObject newUnit = NGUITools.AddChild(CardTable.gameObject, CardUnit_CardPrefab); newUnit.SetActive(true); newUnit.name = "Card_" + CardCfg.CardID; UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>(); mc.UnconditionalShow(CardCfg.CardID); CardTable.repositionNow = true; yield return(new WaitForEndOfFrame()); CardLstRoot.GetComponent <UIScrollView>().ResetPosition(); CurProg++; CommodityLoadProgLab.text = StringBuilderTool.ToString("卡牌加载中(", CurProg, "/", TempToExchangeCardLst.Count, ")..."); } CommodityWaitLoad.SetActive(false); }
void Start() { if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue((int)RoleID, out rc)) { GameObject model = Resources.Load <GameObject>(StringBuilderTool.ToString("Prefabs/Actor/", rc.ModelName)); if (model != null) { GameObject obj = GameObject.Instantiate(model); MyTools.setLayerDeep(obj, LayerMask.NameToLayer("UI")); Root = obj.transform; Root.parent = transform; Root.localPosition = new Vector3(0, -216, -300); Root.localEulerAngles = new Vector3(0, RoleID < 1000 ? 180 : -140, 0); Root.localScale = Vector3.one * RoleModelScale; animation = Root.GetComponent <Animation>(); animator = Root.GetComponent <Animator>(); Name.text = rc.Name; if (rc.UnLockType != 0) { LockIcon.SetActive(true); UnLockConditionLab.text = rc.GetUnLockConditionDes(); } } } //Refresh(); }
public void OnClick_Get() { GameApp.Instance.SoundInstance.PlaySe("button"); GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic); GetBtn.isEnabled = false; GetBtnText.text = "已领取"; foreach (KeyValuePair <int, int> pair in AwardItemDic) { GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair.Key, " ", pair.Value)); } string IsGetStateKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin_IsGetState"); if (PlayerPrefs.HasKey(IsGetStateKey)) { string OldState = PlayerPrefs.GetString(IsGetStateKey); OldState += StringBuilderTool.ToString("_", CurIndex); PlayerPrefs.SetString(IsGetStateKey, OldState); } else { PlayerPrefs.SetString(IsGetStateKey, CurIndex.ToString()); } }
/// <summary> 创建账号服连接 </summary> /*public void CreateUserServerSocket() * { #if UNITY_EDITOR * Debug.Log(StringBuilderTool.ToString("连接账号服 IP:", Const.AccountServerIP, " 端口:", Const.AccountServerPort)); #endif * GameApp.SocketClient_User = SocketClient.SocketConnect(Const.AccountServerIP, Const.AccountServerPort, "SocketClient_User"); * }*/ /// <summary> 登录 </summary> /*public void Login(string account, string password) * { * Msg_Client2Account_Login_Req login = new Msg_Client2Account_Login_Req(); * login.m_account_name = account; * login.m_account_key = password; #if UNITY_EDITOR * Debug.Log(StringBuilderTool.ToString("账号:", login.m_account_name, " 密码:", login.m_account_key)); #endif * Send<Msg_Client2Account_Login_Req>(login, GameApp.SocketClient_User, (int)MsgType.enum_Msg_Client2Account_Login_Req); * }*/ /// <summary> 创建游戏服连接 </summary> public void CreateGameServerSocket() { #if UNITY_EDITOR Const.GameServerIP = "58.246.123.230";//编辑器模式下连接测试服务器 #endif Debug.Log(StringBuilderTool.ToString("连接游戏服 IP:", Const.GameServerIP, " 端口:", Const.GameServerPort)); GameApp.SocketClient_Game = SocketClient.SocketConnect(Const.GameServerIP, Const.GameServerPort, "SocketClient_Game"); }
private void LstDataToString() { TaskInfo = StringBuilderTool.ToString(TempValue1, "#", TempValue2); #if UNITY_EDITOR Debug.Log("最新任务数据:"); Debug.Log(TaskInfo); #endif }
public void RecoverFromPurchased() { Price.text = StringBuilderTool.ToString("[FFFB63]", PriceValue, "[-]"); Price.transform.localPosition = new Vector3(-10, -122, 0); transform.Find("PriceIcon").gameObject.SetActive(true); transform.Find("Bg").GetComponent <UISprite>().spriteName = "lankuang"; PurchasedSign.SetActive(false); }
public PetInfo() { uint AccountID = SerPlayerData.GetAccountID(); key_Name = StringBuilderTool.ToString(AccountID, "_PetInfo_Name"); key_Sex = StringBuilderTool.ToString(AccountID, "_PetInfo_Sex"); key_AgeYeah = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeYeah"); key_AgeMonth = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeMonth"); }
/// <summary> 显示商品详情 </summary> public void ShowCommodityDetails(ItemConfig ItemCfg) { TweenAlpha.Begin(DetailsRoot, 0.1f, 1); Details_ItemCfg = ItemCfg; Details_Name.text = ItemCfg.Name; Details_Des.text = ItemCfg.Describe; Details_HoldNum.text = StringBuilderTool.ToString("已拥有:", SerPlayerData.GetItemCount(ItemCfg.ItemID)); }
public void BuyRes() { CandyCnt.text = SerPlayerData.GetItemCount(1003).ToString(); if (Details_ItemCfg != null) { Details_HoldNum.text = StringBuilderTool.ToString("已拥有:", SerPlayerData.GetItemCount(Details_ItemCfg.ItemID)); } }
public SleepInfo() { uint AccountID = SerPlayerData.GetAccountID(); key_SleepBeginTime = StringBuilderTool.ToString(AccountID, "_PetInfo_SleepBeginTime"); key_SleepEndTime = StringBuilderTool.ToString(AccountID, "_PetInfo_key_SleepEndTime"); key_EnableUseDuration = StringBuilderTool.ToString(AccountID, "_PetInfo_EnableUseDuration"); key_RestUseDuration = StringBuilderTool.ToString(AccountID, "_PetInfo_RestUseDuration"); }
public void Show(bool isShow) { if (isShow) { gameObject.SetActive(true); AppearEffect.transform.localScale = Vector3.one * 0.01f; AppearEffect.Open(AppearType.Popup, AppearEffect.gameObject); GameApp.Instance.UICurrency.Show(true); //AddMail(1531209933, "新手奖励","欢迎加入魔卡百科的世界,为了让你更快的学习知识,我们为你准备了一些补给。"); //AddMail(1531209934, "一封假邮件","一封本不该出现在这里的邮件,仅供测试。"); if (LstGrid.transform.childCount == 0) { int i = 0; foreach (KeyValuePair <uint, MailItemInfo> pair in GameApp.Instance.MailItemsDic) { GameObject newUnit = NGUITools.AddChild(LstGrid, MailItemUnitPrefab); newUnit.SetActive(true); newUnit.name = "MailItemUnit_" + (i++); newUnit.GetComponent <UI_MailItemUnit>().Set(pair.Value); } LstGrid.transform.GetComponent <UIGrid>().repositionNow = true; LstGrid.transform.parent.GetComponent <UIScrollView>().ResetPosition(); } int MailCount = LstGrid.transform.childCount; MailCnt.text = StringBuilderTool.ToString("邮件数:" + MailCount); if (MailCount == 0) { NoMailHintRoot.SetActive(true); MailLstRoot.SetActive(false); DetailsRoot.SetActive(false); } else { NoMailHintRoot.SetActive(false); MailLstRoot.SetActive(true); DetailsRoot.SetActive(true); } InvokeRepeating("UpdateMailRedPoint", 0, 1f); } else { GameApp.Instance.UICurrency.Show(false); AppearEffect.Close(AppearType.Popup, () => { gameObject.SetActive(false); }); } }
public void JoinRoom(uint StageID) { Msg_Client2Logic_PVE_Join_Room_Req j = new Msg_Client2Logic_PVE_Join_Room_Req(); j.m_id = StageID; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送加入房间:", StageID)); #endif Send <Msg_Client2Logic_PVE_Join_Room_Req>(j, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Join_Room_Req); }
public void GetOfflineCandy(int PickNum) { Msg_Client2Logic_Get_Offline_Candy_Req goc = new Msg_Client2Logic_Get_Offline_Candy_Req(); goc.nums = (uint)PickNum; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("获取离线糖果:", PickNum)); #endif Send <Msg_Client2Logic_Get_Offline_Candy_Req>(goc, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_Get_Offline_Candy_Req); }
public void BuyItem(uint ItemID) { Msg_Client2Logic_Buy_Shop_Req buy = new Msg_Client2Logic_Buy_Shop_Req(); buy.id = ItemID; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("购买道具:", ItemID)); #endif Send <Msg_Client2Logic_Buy_Shop_Req>(buy, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_Buy_Shop_Req); }
public void LoadState(int StateIndex) { Msg_Client2Logic_LoadState_Req ls = new Msg_Client2Logic_LoadState_Req(); ls.loadState = StateIndex; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送加载状态:", StateIndex)); #endif Send <Msg_Client2Logic_LoadState_Req>(ls, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_LoadState_Req); }
public void SetGameState(uint GameState) { Msg_Client2Logic_PVE_SetGameState_Room_Req sgs = new Msg_Client2Logic_PVE_SetGameState_Room_Req(); sgs.game_state = GameState; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送游戏状态:", GameState)); #endif Send <Msg_Client2Logic_PVE_SetGameState_Room_Req>(sgs, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_SetGameState_Room_Req); }
public void BossQuestionAnswerSucceed() { Msg_Client2Logic_PVE_Trigger_Effect_Room_Req te = new Msg_Client2Logic_PVE_Trigger_Effect_Room_Req(); te.type = RoomPosType.RoomPosType_DevilAnswerRight; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送魔王答题成功")); #endif Send <Msg_Client2Logic_PVE_Trigger_Effect_Room_Req>(te, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Trigger_Effect_Room_Req); }
public void Throw(uint DiceNum) { Msg_Client2Logic_PVE_Throw_Room_Req t = new Msg_Client2Logic_PVE_Throw_Room_Req(); t.dice_num = DiceNum; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送投掷筛子:", DiceNum)); #endif Send <Msg_Client2Logic_PVE_Throw_Room_Req>(t, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Throw_Room_Req); }
public void ReadyInRoom(bool IsReady) { Msg_Client2Logic_PVE_Ready_Room_Req r = new Msg_Client2Logic_PVE_Ready_Room_Req(); r.is_ready = IsReady; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送在房间中准备:", IsReady)); #endif Send <Msg_Client2Logic_PVE_Ready_Room_Req>(r, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Ready_Room_Req); }
public void CreateRoom(uint StageID) { Msg_Client2Logic_PVE_Create_Room_Req c = new Msg_Client2Logic_PVE_Create_Room_Req(); c.m_id = StageID; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送创建房间:", StageID)); #endif Send <Msg_Client2Logic_PVE_Create_Room_Req>(c, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Create_Room_Req); }
public void EnableEnterStage(uint StageID) { Msg_Client2Logic_PVE_Enter_Req e = new Msg_Client2Logic_PVE_Enter_Req(); e.m_id = StageID; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送检测是否允许进入关卡:", StageID)); #endif Send <Msg_Client2Logic_PVE_Enter_Req>(e, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_PVE_Enter_Req); }
public void SaveContestMemInfo(string ContestMemInfo) { Msg_Client2Logic_SaveContestMemInfo_Req scmi = new Msg_Client2Logic_SaveContestMemInfo_Req(); scmi.memInfo = ContestMemInfo; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("保存赛事备忘数据 ", ContestMemInfo)); #endif Send <Msg_Client2Logic_SaveContestMemInfo_Req>(scmi, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_SaveContestMemInfo_Req); }
public void SetAvatar(uint AvatarID) { Msg_Client2Logic_Change_Avatar_Req ca = new Msg_Client2Logic_Change_Avatar_Req(); ca.id = AvatarID; #if UNITY_EDITOR Debug.Log(StringBuilderTool.ToString("发送设置换装ID", AvatarID)); #endif Send <Msg_Client2Logic_Change_Avatar_Req>(ca, GameApp.SocketClient_Game, (int)MsgType.enum_Msg_Client2Logic_Change_Avatar_Req); }