static int CreateUI(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string))) { string arg0 = ToLua.ToString(L, 1); UnityEngine.Transform o = UIAPI.CreateUI(arg0); ToLua.Push(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(bool))) { string arg0 = ToLua.ToString(L, 1); bool arg1 = LuaDLL.lua_toboolean(L, 2); UnityEngine.Transform o = UIAPI.CreateUI(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIAPI.CreateUI")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void OnFightAgainAccept(object message) { var ntf = message as ZonePvp1v1AccepteNtf; if (!ntf.accept) { _CloseWindow(null); if (!string.IsNullOrEmpty(ntf.reason)) { UIAPI.ShowMsgTip(ntf.reason); } else { if (!ntf.is_fight) { UIAPI.ShowMsgTip("对方已拒绝你的邀请"); } else { if (ntf.reason == "") { UIAPI.ShowMsgTip("对方当前状态不能接受邀请"); } else { UIAPI.ShowMsgTip(ntf.reason); } } } } }
private void OnFriendAccept(object message) { var ntf = message as ZonePvp1v1AccepteNtf; if (!ntf.accept) { if (actData != null && actData.remain_times > 0) { ActCenterPlugin plugin = KH.KHPluginManager.Instance.GetPluginByName(KH.Plugins.ActCenterPlugin.NAME) as KH.Plugins.ActCenterPlugin; plugin.InvokeActFun((uint)actData.act_id, "ReqCmd7"); } else { _CloseWindow(null); } if (!string.IsNullOrEmpty(ntf.reason)) { UIAPI.ShowMsgTip(ntf.reason); } else { if (!ntf.is_fight) { UIAPI.ShowMsgTip("好友已拒绝你的比试邀请"); } else { UIAPI.ShowMsgTip("好友当前状态不能接受邀请"); } } } }
private bool AddModule(string path, object arg = null) { var uiModule = UIRes.LoadPrefab(path); if (uiModule != null) { CheckNewItem(); for (int i = 0; i < go.transform.childCount; i++) { GameObject child = go.transform.GetChild(i).gameObject; Destroy(child); } var module = GameObject.Instantiate(uiModule); module.transform.SetParent(go.transform, false); //module.transform.parent = go.transform; //module.transform.localPosition = Vector3.zero; //module.GetComponent<RectTransform>().localPosition = Vector3.zero; module.name = path.Split('/').Last(); return(true); } else { UIAPI.ShowMsgBox(path.Split('/').Last(), "模块开发中。。。", "确定"); return(false); } }
private void InviteFightAgain(object data) { FightAgainData againData = data as FightAgainData; var req = new ZonePvp1v1InviteReq(); req.friend_gid = againData.player_id; req.friend_zone = againData.zoneid; req.invite = true; req.plat_friend = false; req.fight_again = true; req.pvp_type = againData.pvp_type; NetworkManager.Instance.Send <ZonePvp1v1InviteReq>((uint)ZoneCmd.ZONE_PVP_1V1_INVITE, req, (object fullInfo) => { ZonePvp1v1InviteResp resp = fullInfo as ZonePvp1v1InviteResp; if (resp.ret_info.ret_code == 0) { isStarted = true; } else { ErrorCodeCenter.DefaultProcError(resp.ret_info); _CloseWindow(null); } }, false, timeoutCallback => { UIAPI.ShowMsgTip("邀请再来一战超时"); _CloseWindow(null); }); }
static int SetToggle(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(bool))) { UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1); bool arg1 = LuaDLL.lua_toboolean(L, 2); UIAPI.SetToggle(arg0, arg1); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(int))) { UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1); int arg1 = (int)LuaDLL.lua_tonumber(L, 2); UIAPI.SetToggle(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIAPI.SetToggle")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void OnBtnUplevel() { AudioControl.PlayEffect(GameDef.clickEffect); costCoin = (uint)skill.costCoin[level - 1]; costOCoin = (uint)skill.costOCoin[level - 1]; UIAPI.ShowMsgBox("技能升级", "是否花费" + costCoin + "金币和" + costOCoin + "灵石升级" + skill.skillName, "确定|取消", UpLevel); }
private void BuyFood(object arg) { if ((int)arg == 0) { var ud = AppConfig.Value.mainUserData; if (ud.food == ud.stat_num[5]) { UIAPI.ShowMsgBox("提示", "仓库已满,无需购买", "确定"); } else if (ud.coins >= 500) { ud.coins -= 500; ud.food += 100; if (ud.food > ud.stat_num[5]) { ud.food = (uint)ud.stat_num[5]; } AppConfig.Value.mainUserData = ud; AppConfig.Save(); } else { UIAPI.ShowMsgBox("提示", "金币不足", "确定"); } } }
// Use this for initialization void Start() { Transform t; for (int k = 1; k <= 4; k++) { t = transform.FindChild("Player" + k + "/Old/"); for (int i = 0; i < 3; i++) { UIAPI.SetPaiEx(t.GetChild(i), i); } t = transform.FindChild("Player" + k + "/Pai/"); for (int i = 0; i < 3; i++) { UIAPI.SetPaiEx(t.GetChild(i), i); } t = transform.FindChild("Player" + k + "/Hold/"); for (int i = 0; i < 3; i++) { UIAPI.SetPaiEx(t.GetChild(i), i); } t = transform.FindChild("Player" + k + "/PaiHu/"); for (int i = 0; i < 3; i++) { UIAPI.SetPaiEx(t.GetChild(i), i); } } }
private void Update() { UpdateVolume(); float per_hp = (float)Math.Round(1.0f * GameControl.gameData.currentHP / GameControl.gameData.maxHP, 2); if (HPVolume.transform.localScale.x != per_hp) { HPVolume.transform.SetScaleX(Mathf.Lerp(HPVolume.transform.localScale.x, per_hp, Time.deltaTime * 4)); if (Mathf.Abs(per_hp - HPVolume.transform.localScale.x) <= 0.01) { HPVolume.transform.SetScaleX(per_hp); } } if (GameControl.gameData.currentHP != lastHP) { lastHP = GameControl.gameData.currentHP; CheckPlayerDie(); } if (GameControl.gameData.BOSS_die) { GameDef.isFight = true; AudioControl.PlayEffect(GameDef.winEffect, 0.5f); UIAPI.ShowMsgBox("胜利", "成功击败BOSS,即将退出冒险世界", "确定", delegate(object arg) { Settlement(2); }); GameControl.gameData.BOSS_die = false; } }
private void OpenChestH(object arg) { System.Random r = new System.Random(); int coin = r.Next(3 * monster.m_coin[m_level], 5 * monster.m_coin[m_level]); int ocoin = r.Next(2 * monster.m_ocoin[m_level], 5 * monster.m_ocoin[m_level]); int collection = r.Next(0, (m_level + 1) * (GameData.collectItem.Count() / 5 + 1) > GameData.collectItem.Count() ? GameData.collectItem.Count() : (m_level + 1) * (GameData.collectItem.Count() / 5 + 1) + 1); GameControl.gameData.colloctions.Add(collection); //Debug.Log(collection); StringBuilder gain = new StringBuilder(); gain.Append("<color=#FFD800>金币 * " + coin + "</color>\n<color=#FB00D4>灵石 * " + ocoin + "</color>\n<color=red>" + GameData.collectItem[collection].itemName + "</color>"); var ud = AppConfig.Value.mainUserData; switch (GameControl.gameData.BOSSID) { case 12: if (!ud.stone[2] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 5) { if (GameAPI.IsMeet(0.5f)) { ud.stone[2] = true; gain.Append("\n<color=#FA800A>人元石</color>"); GameControl.gameData.stone = 2; } } break; case 13: if (!ud.stone[1] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 10) { if (GameAPI.IsMeet(0.25f)) { ud.stone[1] = true; gain.Append("\n<color=#FA800A>地元石</color>"); GameControl.gameData.stone = 1; } } break; case 14: if (!ud.stone[0] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 15) { if (GameAPI.IsMeet(0.1f)) { ud.stone[0] = true; gain.Append("\n<color=#FA800A>天元石</color>"); GameControl.gameData.stone = 0; } } break; } AppConfig.Value.mainUserData = ud; AppConfig.Save(); UIAPI.ShowMsgBox("高级宝箱", gain.ToString(), "确定", Quit); GameControl.gameData.gainCoin += coin; GameControl.gameData.gainOCoin += ocoin; }
public void StopRecord() { #if UNITY_EDITOR if (true) { return; } #endif if (mLogin == false) { return; } GameAPI.PauseAllSound(false); UIAPI.DebugLog("结束录音"); if (clipCor != null) { StopCoroutine(clipCor); clipCor = null; } YunVaImSDK.instance.RecordStopRequest(StopRecordResponse); }
public void StartRecord(LuaFunction fun, float maxTime) { if (mRecording) { return; } if (mLogin == false) { return; } YunVaImSDK.instance.RecordStopPlayRequest(); GameAPI.PauseAllSound(true); UIAPI.DebugLog("开始录音"); #if UNITY_EDITOR if (true) { return; } #endif endFun = fun; clipCor = StartCoroutine(OnTimeOut(maxTime)); mRecording = true; string filePath = string.Format("{0}/{1}.amr", Application.persistentDataPath, DateTime.Now.ToFileTime()); YunVaImSDK.instance.RecordStartRequest(filePath); }
//显示模块的主UI protected override void Show(object arg) { arg = AudioManager.Instance.BgmVolume; base.Show(arg); UIAPI.ShowUIPage(UIDef.UISettingPage, arg); }
private void SendMatchEnemyReq(object data) { PVPRealTimeMainUIModel.MatchType = PVPMatchType.Enemy; MatchEnemyData tmpData = data as MatchEnemyData; ZonePvp1v1MatchReq req = new ZonePvp1v1MatchReq(); int state = KHUtil.GetInt(UISettingMoreView.OnlyReal, 0); req.only_real_player = state == 1; NetworkManager.Instance.Send((uint)ZoneCmd.ZONE_PVP_1V1_MATCH, req, (object fullInfo) => { ZonePvp1v1MatchResp resp = fullInfo as ZonePvp1v1MatchResp; if (resp.ret_info.ret_code == 0) { tmpData.expectSeconds = (int)resp.expect_wait_second; EstimatedTimeLabel.text = tmpData.expectSeconds + "秒"; NGUITools.SetActive(EstimatedContainer.gameObject, true); isStarted = true; } else { ErrorCodeCenter.DefaultProcError(resp.ret_info); _CloseWindow(null); } }, false, onTimeout => { UIAPI.ShowMsgTip("匹配请求超时"); _CloseWindow(null); }); }
public void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { Kurisu.Service.UIManager.UIWindow ui = UIAPI.ShowUIWindow(UIDef.UIGameExitWindow); ui.transform.SetAsLastSibling(); } }
// Use this for initialization void Start() { UIAPI.ShowMsgBox("testTitle", "testContent", "yes|no|cancel", (args) => { LDebugger.Log(this.GetType().ToString(), "testMsgBox" + args); }); }
public void OnMapItemClick() { if (m_model == null || !m_model.IsUnlocked) { return; } UIAPI.ShowUIWindow(UIDef.UIMapItemDetailWindow, m_model.MapConfigData); }
internal static void AdventureStartFunc() { if (!AppConfig.Value.mainUserData.GuideFlag[AdventureStart]) { UIAPI.ShowMsgBox("新手引导", "欢迎进入冒险世界,跟随指引熟悉一下界面吧!", "确定", arg => { GameObject go = Resources.Load(UIDef.UIAdventurePanelGuide) as GameObject; if (go != null) { GameObject obj = GameObject.Instantiate(go); AddChild(obj); Text guideInfo = GameObject.Find("GuideInfo").GetComponent <Text>(); GameObject bootArrow = GameObject.Find("BootArrow"); Button onTargetClick = GameObject.Find("OnTargetClick").GetComponent <Button>(); bootArrow.transform.localPosition = new Vector3(200, 900, 0); bootArrow.transform.SetScaleXYZ(2, 2, 2); bootArrow.transform.localEulerAngles = new Vector3(0, 0, -90); guideInfo.text = "人物血量,低于0,则丢失在当前世界获得的全部物品,返回主世界"; onTargetClick.onClick.AddListener(() => { bootArrow.transform.localPosition = new Vector3(200, 800, 0); guideInfo.text = "食物,人物行走消耗一定量的食物,当食物消耗完,则消耗两倍量的生命"; onTargetClick.onClick.RemoveAllListeners(); onTargetClick.onClick.AddListener(() => { bootArrow.transform.localPosition = new Vector3(200, 700, 0); guideInfo.text = "攻击和防御是决定伤害的两个属性,己方攻击减去敌方防御即为对敌方造成的伤害"; onTargetClick.onClick.RemoveAllListeners(); onTargetClick.onClick.AddListener(() => { bootArrow.transform.localPosition = new Vector3(-400, -660, 0); bootArrow.transform.SetScaleXYZ(3, 3, 3); bootArrow.transform.localEulerAngles = Vector3.zero; guideInfo.text = "单击选择一块地图,再点击左下角查询,可获取所选地图的信息,只能单击人物周围两格的地图哦!"; onTargetClick.onClick.AddListener(() => { guideInfo.text = "当人物行走在有特殊的地图块上时,点击按钮可进行相应的操作"; bootArrow.transform.localPosition = new Vector3(0, -660, 0); onTargetClick.onClick.RemoveAllListeners(); onTargetClick.onClick.AddListener(() => { guideInfo.text = "点击右下角的搜索,可探寻BOSS相对于你的位置。人物行走通过在屏幕上<color=red>滑动</color>,向着BOSS进发吧,冒险者!"; bootArrow.transform.localPosition = new Vector3(400, -660, 0); onTargetClick.onClick.RemoveAllListeners(); onTargetClick.onClick.AddListener(() => { GameObject.Destroy(obj); AppConfig.Value.mainUserData.GuideFlag[AdventureStart] = true; AppConfig.Save(); }); }); }); }); }); }); } }); } }
public static void AnimSazhi(int n1, int n2) { Transform t = UIAPI.ShowEffect(UIAPI.gCanvas, "AnimSazhi"); AnimImage[] ms = t.GetComponentsInChildren <AnimImage>(); ms[0].Play(4, n1 - 1); ms[1].Play(4, n2 - 1); }
public void SetCurrScene(GameObject sceneGo) { CurrActiveScene = _Add(sceneGo); // for (int i = 0; i < sceneUnits.Count; ++i) { UIAPI.SetVisible(sceneUnits[i].scene, (sceneUnits[i] == CurrActiveScene) || (sceneUnits[i] == Logic)); } }
private void OnGameEnd() { m_game = null; UIAPI.ShowMsgBox("游戏结束", "显示游戏积分...", "确定", (arg) => { UIManager.Instance.GoBackPage(); }); }
/// <summary> /// 暂停游戏 /// </summary> public void PauseGame() { if (m_game == null) { return; } m_game.Pause(); UIAPI.ShowUIWindow(UIDef.UIPveGamePauseWindow); }
private void Start() { uiapi = GameObject.Find("Canvas").GetComponent <UIAPI>(); rapidFire = false; uiapi.SetSliderMax(fireRate); //slider.maxValue = RespawnTime; uiapi.SetSlider(fireRate); //slider.value = RespawnTime; }
public void OnBtnUserInfo() { UIAPI.ShowMsgBox("重新登录", "是否重新登录?", "确定|取消", o => { if ((int)o == 0) { HomeModule module = ModuleManager.Instance.GetModule(ModuleDef.HomeModule) as HomeModule; module.TryReLogin(); } }); }
private void CheckPlayerDie() { if (lastHP <= 0) { GameDef.isFight = true; AudioControl.StopBGMusic(); AudioControl.PlayEffect(GameDef.failEffect, 0.5f); GameControl.gameData.Statistics[GameData.Statist[(int)GameData.SID.DEATH]]++; UIAPI.ShowMsgBox("失败", "人物死亡,失去全部物品", "确定", Settlement); } }
private void OpenChestL(object arg) { System.Random r = new System.Random(); int coin = r.Next(monster.m_coin[m_level], 3 * monster.m_coin[m_level]); int ocoin = r.Next(0, 3 * monster.m_ocoin[m_level]); UIAPI.ShowMsgBox("低级宝箱", "<color=#FFD800>金币 * " + coin + "</color>\n<color=#FB00D4>灵石 * " + ocoin + "</color>", "确定", (args) => { GameDef.isFight = false; }); GameControl.gameData.gainCoin += coin; GameControl.gameData.gainOCoin += ocoin; }
public void Login(int appid, string sUserId, string name) { #if UNITY_EDITOR if (true) { return; } #endif if (mInit == false) { EventListenerManager.AddListener(ProtocolEnum.IM_RECORD_VOLUME_NOTIFY, ImRecordVolume);//录音音量大小回调监听 int init = YunVaImSDK.instance.YunVa_Init(0, (uint)appid, Application.persistentDataPath, false); if (init == 0) { UIAPI.DebugLog("初始化成功..."); } else { UIAPI.DebugLog("初始化失败..."); } mLogin = false; mRecording = false; mInit = true; } if (mLogin) { return; } string ttFormat = "{{\"nickname\":\"{0}\",\"uid\":\"{1}\"}}"; string tt = string.Format(ttFormat, sUserId, sUserId); string[] wildcard = new string[2]; wildcard[0] = "0x001"; wildcard[1] = "0x002"; YunVaImSDK.instance.YunVaOnLogin(tt, "1", wildcard, 0, (data) => { if (data.result == 0) { mLogin = true; YunVaImSDK.instance.RecordSetInfoReq(true);//开启录音的音量大小回调 UIAPI.DebugLog("登录成功"); } else { UIAPI.DebugLog("登录失败"); } }); }
private void OpenChestM(object arg) { System.Random r = new System.Random(); int coin = r.Next(2 * monster.m_coin[m_level], 4 * monster.m_coin[m_level]); int ocoin = r.Next(1 * monster.m_ocoin[m_level], 4 * monster.m_ocoin[m_level]); int food = r.Next(10, 20); UIAPI.ShowMsgBox("中级宝箱", "<color=#FFD800>金币 * " + coin + "</color>\n<color=#FB00D4>灵石 * " + ocoin + "</color>\n<color=#00FF0C>食物 * " + food + "</color>", "确定", Quit); GameControl.gameData.gainCoin += coin; GameControl.gameData.gainOCoin += ocoin; GameControl.gameData.currentFood += food; }
void InitClient() { UIAPI.Init(); GameAPI.Init(); Instance = this; Init(); #if UNITY_5_4 SceneManager.sceneLoaded += OnSceneLoaded; #endif }