void OnClick() { if (gameObject.name == "bt_StartGame") { EnterGame(); } else if (gameObject.name == "bt_PlayVideo") { GameObject mainCamera = GameObject.Find("@MainCamera"); if (mainCamera != null && (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)) { sdMovieVideo movie = mainCamera.GetComponent <sdMovieVideo>(); if (movie != null) { movie.PlayMovie("DS_intro.mp4"); } } //sdUICharacter.Instance.ShowMsgLine("错误提示测试!",MSGCOLOR.Red); } else if (gameObject.name == "bt_Username") { Debug.Log("bt_Username button onclick"); sdUICharacter.Instance.HideLoginMsg(); GameObject goUIRoot = GameObject.Find("UI Root (2D)"); if (goUIRoot) { Debug.Log("Find ui root"); GHome.GetInstance().Logout((code, msg, data) => { Debug.Log("GHome logout callback code: " + code + "msg: " + msg); if (code == 0) { LoginUI loginUI = goUIRoot.GetComponent <LoginUI>(); loginUI.Relogin(); } }); } gameObject.SetActive(false); } else if (gameObject.name == "bt_Server") { List <JsonNode> lst = SDNetGlobal.m_lstSrvInfo; if (lst.Count > 0) { sdUICharacter.Instance.ShowSelectSrvWnd(true); } } }
public void OnClick() { // 播放动画阶段点击无效.. if (m_SelectChar.IsLeaveSelectUIFinish() == false) { return; } // 如果角色名为空,则直接返回aa if (SDNetGlobal.playerList[m_CurrentSelect].mRoleName.Length <= 0) { return; } string first = sdConfDataMgr.Instance().GetSetting("firstEnter"); if (first.Length == 0 && (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)) { GameObject camera = GameObject.Find("@MainCamera"); if (camera != null) { sdMovieVideo movie = camera.AddComponent <sdMovieVideo>(); if (movie != null) { if (movie.PlayMovie("DS_intro.mp4") == false) { Debug.Log("play movie error"); } } } sdConfDataMgr.Instance().SetSetting("firstEnter", "0"); } SDNetGlobal.lastSelectRole = m_CurrentSelect; // 隐藏预览的角色aa if (m_SelectChar) { m_SelectChar.DoSelect(-1); } // 显示LOADING窗口aa if (m_NeedHideObject1) { m_NeedHideObject1.SetActive(false); } if (m_NeedHideObject2) { m_NeedHideObject2.SetActive(false); } if (m_NeedHideObject3) { m_NeedHideObject3.SetActive(false); } if (m_NeedHideObject4) { m_NeedHideObject4.SetActive(false); } sdUILoading.ActiveLoadingUI(0); // 通知服务器当前选中的角色aa CliProto.CG_SELECTROLE refMSG = new CliProto.CG_SELECTROLE(); refMSG.m_RoleDBID = SDNetGlobal.playerList[m_CurrentSelect].mDBID; SDNetGlobal.SendMessage(refMSG); SDGlobal.Log("CG_SELECTROLE"); }
void Update() { if (bInited == false) { Hashtable data = sdGlobalDatabase.Instance.globalData; if (data.ContainsKey("OpenLevel_Index")) { bInited = true; int level = (int)data["OpenLevel_Index"]; bool first = (int)data["OpenLevel_FirstTime"] == 1; data["OpenLevel_FirstTime"] = 0; SetLevelState(level, first); } } if (mapShowStep >= 0) { if (mapShowStep == 0) { fCurrent += Time.deltaTime; if (fCurrent > fShowTime0) { fCurrent = 0; mapShowStep = 1; } if (FxDianji.activeSelf && FxDianji.transform.localPosition.x < 300.0f) { Vector3 v = FxDianji.transform.localPosition; FxDianji.transform.localPosition = new Vector3(v.x + 1000.0f, v.y, v.z); } } else if (mapShowStep == 1) { // 镜头推近. fCurrent += Time.deltaTime; if (fCurrent <= fShowTime1) { float f = (fCurrent * fCurrent) / (fShowTime1 * fShowTime1); float x = CameraPos0.x + (CameraPos1.x - CameraPos0.x) * f; float y = CameraPos0.y + (CameraPos1.y - CameraPos0.y) * f; float z = CameraPos0.z + (CameraPos1.z - CameraPos0.z) * f; sdGameLevel.instance.mainCamera.transform.localPosition = new Vector3(x, y, z); } else { sdGameLevel.instance.mainCamera.transform.localPosition = CameraPos1; fCurrent = 0; mapShowStep = 2; currentIndex = -1; } } else if (mapShowStep == 2) { // 道路动画. fCurrent += Time.deltaTime; if (fCurrent <= fShowTime2) { if (roadArray == null) { fCurrent = 1000.0f; } else { float f = (fCurrent / fShowTime2) * (float)roadArray.Length; int ShowCount = (int)f; if (ShowCount != currentIndex) { currentIndex = ShowCount; roadArray[currentIndex].enabled = true; } } } else { int level = (int)sdGlobalDatabase.Instance.globalData["OpenLevel_Index"]; if (level == 20) // 判断是否是城堡 { mapShowStep = 3; if (MainCityStart) { MainCityStart.SetActive(false); } if (MainCityAnim) { MainCityAnim.SetActive(true); } } else { mapShowStep = 4; } fCurrent = 0; } } else if (mapShowStep == 3) { // 城堡升起动画. fCurrent += Time.deltaTime; if (fCurrent <= fShowTime3) { //float f = fCurrent / fShowTime3; } else { if (MainCityStart) { MainCityStart.SetActive(false); } if (MainCityEnd) { MainCityEnd.SetActive(true); } if (MainCityAnim) { MainCityAnim.SetActive(false); } if (MainCityEffect1) { MainCityEffect1.SetActive(true); } if (MainCityEffect2) { MainCityEffect2.SetActive(true); } fCurrent = 0; mapShowStep = 4; } } else if (mapShowStep == 4) { // 关卡名称显示. fCurrent += Time.deltaTime; if (fCurrent <= fShowTime4) { float f = fCurrent / fShowTime4; if (levelText.activeSelf == false) { levelText.SetActive(true); } levelText.GetComponent <Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f, f); } else { levelText.GetComponent <Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f); fCurrent = 0; mapShowStep = 5; } } else if (mapShowStep == 5) { // 镜头拉回原位. fCurrent += Time.deltaTime; if (fCurrent <= fShowTime5) { float f = (fCurrent * fCurrent) / (fShowTime5 * fShowTime5); float x = CameraPos1.x + (CameraPos0.x - CameraPos1.x) * f; float y = CameraPos1.y + (CameraPos0.y - CameraPos1.y) * f; float z = CameraPos1.z + (CameraPos0.z - CameraPos1.z) * f; sdGameLevel.instance.mainCamera.transform.localPosition = new Vector3(x, y, z); } else { sdGameLevel.instance.mainCamera.transform.localPosition = CameraPos0; sdGameLevel.instance.WordMapCameraPos = CameraPos0; mapShowStep = 6; if (FxDianji.activeSelf && FxDianji.transform.localPosition.x > 300.0f) { Vector3 v = FxDianji.transform.localPosition; FxDianji.transform.localPosition = new Vector3(v.x - 1000.0f, v.y, v.z); } } } else if (mapShowStep == 6) { string strEnter = sdConfDataMgr.Instance().GetSetting(mLevel.ToString() + "_firstenter"); if (strEnter.Length == 0 && (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)) { GameObject mainCamera = GameObject.Find("@MainCamera"); if (mainCamera != null) { sdMovieVideo movie = mainCamera.AddComponent <sdMovieVideo>(); if (movie != null) { Hashtable table = sdConfDataMgr.Instance().GetTable("moviebattle"); if (table != null) { if (table.ContainsKey(mLevel.ToString())) { mapShowStep = -1; AudioSource audio = sdGameLevel.instance.gameObject.GetComponent <AudioSource>(); if (audio != null) { audio.Stop(); } Hashtable data = table[mLevel.ToString()] as Hashtable; movie.PlayMovie((string)data["filename"]); } } } } sdConfDataMgr.Instance().SetSetting(mLevel.ToString() + "_firstenter", "0"); } mapShow(); } } }