protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/Right"); SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(-70, 100, 0); var btnXuQi = FindComponent <MogoUIBtn>("BtnXuQi"); btnXuQi.SetText(LanguageData.GetContent(100)); var pressedMgr = btnXuQi.gameObject.AddComponent <BtnPressedMgr>(); pressedMgr.ActionPressed = OnPressXuQi; pressedMgr.ActionUnPressed = OnUnPressXuQi; m_btnFly = FindComponent <MogoUIBtn>("BtnFly"); m_btnFly.ClickAction = OnBtnFly; m_btnJump = FindComponent <MogoUIBtn>("BtnJump"); m_btnJump.ClickAction = OnBtnJump; m_btnJump.SetText(LanguageData.GetContent(105)); m_goKeyCodeXuqi = FindTransform("KeyCodeXuqi").gameObject; m_goKeyCodeXuqi.transform.FindChild("LblKeyCodeXuqi").GetComponent <UILabel>().text = LanguageData.GetContent(151); m_goKeyCodeFlyState = FindTransform("KeyCodeFly").gameObject; m_goKeyCodeFlyState.transform.FindChild("LblKeyCodeFly").GetComponent <UILabel>().text = LanguageData.GetContent(152); m_goKeyCodeJump = FindTransform("KeyCodeJump").gameObject; m_goKeyCodeJump.transform.FindChild("LblKeyCodeJump").GetComponent <UILabel>().text = LanguageData.GetContent(154); SetKeyCodeActive(); AddListeners(); }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/Center"); SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0, 0, 0); m_myTransform.localScale = new Vector3(1.0f, 1.0f, 1f); MogoUIBtn _btn = FindTransform("BtnOk").GetComponent <MogoUIBtn>(); _btn.SetText(LanguageData.GetContent(3)); _btn.ClickAction = OnCloseUI; //LoggerHelper.Error(LanguageData.GetContent(3)); ScoreList = new List <List <UILabel> >(); for (int i = 0; i < 2; i++) { ScoreList.Add(new List <UILabel>()); for (int j = 0; j < 5; j++) { ScoreList[i].Add(FindTransform(string.Concat("Score", i, "Text", j)).GetComponent <UILabel>()); FindTransform(string.Concat("ScoreName", i, "Text", j)).GetComponent <UILabel>().text = LanguageData.GetContent(173 + j); } } ShowScore(); }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/Center"); SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0, -280, -10); m_myTransform.localScale = new Vector3(1.0f, 1.0f, 1f); StarNameTxt = FindTransform("StarName").GetComponent <UILabel>(); EnergyTxt = FindTransform("LblEnergy").GetComponent <UILabel>(); EnergySp = FindTransform("EnergyBar").GetComponent <UISprite>(); EnergyGo = FindTransform("Energy").gameObject; BuildingNumTxt = FindTransform("BuildingNumTxt").GetComponent <UILabel>(); SetBuildingInfo(); GatherBtn = FindTransform("EufloriaBtnGather").GetComponent <MogoUIBtn>(); AttackBtn = FindTransform("EufloriaBtnAttack").GetComponent <MogoUIBtn>(); GatherBtn.ClickAction = OnEufloriaBtnGatherAction; AttackBtn.ClickAction = OnEufloriaBtnAttackAction; GatherBtn.SetText(LanguageData.GetContent(185)); AttackBtn.SetText(LanguageData.GetContent(184)); HideAllInfo(); AddListeners(); }
private void SetBuildingInfo() { BuildingList = FindTransform("BuildingList").gameObject; //显示建筑列表 Transform buildingBg = FindTransform("ImgBg"); MogoUIBtn buildingType = FindTransform("BuildingType").GetComponent <MogoUIBtn>(); BuildingTypeList.Clear(); int i = 0; foreach (BuildingData data in BuildingData.dataMap.Values) { GameObject copyBuildingsBg = GameObject.Instantiate(buildingBg.gameObject) as GameObject; GameObject copyBuildingType = GameObject.Instantiate(buildingType.gameObject) as GameObject; copyBuildingsBg.transform.parent = BuildingList.transform; copyBuildingType.transform.parent = BuildingList.transform; copyBuildingsBg.transform.localScale = new Vector3(80, 80, 80); copyBuildingsBg.SetActive(true); copyBuildingType.transform.localScale = new Vector3(1, 1, 1); copyBuildingType.SetActive(true); copyBuildingsBg.transform.localPosition = new Vector3(i * 90, 0, 0); copyBuildingType.transform.localPosition = copyBuildingsBg.transform.localPosition; MogoUIBtn btn = copyBuildingType.GetComponent <MogoUIBtn>(); BuildingTypeList.Add(btn); BuildingTypeList[i].IDUint64 = (ulong)data.id; BuildingTypeList[i].SetText(LanguageData.GetContent(data.name)); BuildingTypeList[i].m_imgNormal.spriteName = data.icon; BuildingTypeList[i].m_imgPressed.spriteName = data.icon; UIEventListener.Get(BuildingTypeList[i].gameObject).onPress = OnPressBuildingAction; i++; } }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_dataMapManager.GetUnitStarById(MogoWorld.thePlayer.HeadQuarterId).UnitParent.parent; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); ComfirmBtn = FindTransform("EufloriaBtnOK").GetComponent <MogoUIBtn>(); CancelBtn = FindTransform("EufloriaBtnCancel").GetComponent <MogoUIBtn>(); ReconSoldierBtn = FindTransform("ReconSoldierBtn").GetComponent <MogoUIBtn>(); DeleteBtn = FindTransform("EufloriaBtnDelete").GetComponent <MogoUIBtn>(); PercentBtn = FindTransform("PercentBtn").GetComponent <MogoUIBtn>(); ComfirmBtn.ClickAction = OnComfirmBtnClickHandler; CancelBtn.ClickAction = OnCancelBtnClickHandler; ReconSoldierBtn.ClickAction = OnReconSoldierBtnClickHandler; DeleteBtn.ClickAction = OnDeleteBtnClickHandler; ComfirmBtn.gameObject.SetActive(false); CancelBtn.gameObject.SetActive(false); ReconSoldierBtn.gameObject.SetActive(false); DeleteBtn.gameObject.SetActive(false); ComfirmBtn.SetText(LanguageData.GetContent(186)); CancelBtn.SetText(LanguageData.GetContent(187)); DeleteBtn.SetText(LanguageData.GetContent(188)); var opt = OptDragListener.Get(PercentBtn.gameObject); opt.onDrag = UpdateArrow; ReconSoldierBtn.SetText(LanguageData.GetContent(182)); ShowPercent(true); AddListeners(); }
private void OnBtnStart(MogoUIBtn btn) { LoggerHelper.Debug("OnBtnStart"); //MogoWorld.m_uiManager.LoadEufloriaBarrierUI(); //UIManager.I.ShowUI<MapMgr>(); //UIManager.I.ShowUI<MapControllerMgr>(); }
private void OnBtnClose(MogoUIBtn btn) { UIManager.I.CloseUI <NoviceGuideUIMgr>(); if (m_isShowGameStart) { UIManager.I.ShowUI <GameStartUIMgr>(); } }
private void OnClickOk(MogoUIBtn btn) { if (okAction != null) { okAction(); okAction = null; } Close(); }
private void OnClickStar(MogoUIBtn btn) { StarInfoController.getInstance().ShowStarInfoUI(UnitId); if (StarInfoController.getInstance().GetCurAttackStatus() == 0) { MovingRange.SetActive(true); SelectSign.SetActive(true); } }
private void OnClickCanCel(MogoUIBtn btn) { if (cancelAction != null) { cancelAction(); cancelAction = null; } Close(); }
private void OnBtnJoin(MogoUIBtn btn) { LoggerHelper.Debug("OnBtnJoin"); UIManager.I.CloseUI <EufloriaMainUIMgr>(); //UIManager.I.ShowUI<MapUIMgr>(); //UIManager.I.ShowUI<StarInfoUIMgr>(); //MogoWorld.m_sceneManager.LoadMapScene(); }
private void OnBtnJoin(MogoUIBtn btn) { if (CheckNameError()) { return; } MogoWorld.ConnectServer(m_inputServerIP.text, 43998); MogoWorld.Login(); MogoWorld.ServerIP = m_inputServerIP.text; }
private void OnCloseUI(MogoUIBtn btn) { MogoWorld.CloseUI(); //MogoWorld.StartGame(); //MogoWorld.m_sceneManager.LoadLoginScene(); //MogoWorld.m_uiManager.LoadMainUI(); //MogoWorld.DisConnectServer(); MogoWorld.OnMainUILoaded(); MogoWorld.m_sceneManager.LoadLoginScene(); MogoWorld.Quit(); }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0f, 0f, 0f); m_btnClose = FindComponent <MogoUIBtn>("CloseBtn"); m_btnClose.ClickAction = OnBtnClose; AddListeners(); }
void Awake() { m_myTransform = transform; //Initialize(); if (!m_lblBoxText) { m_lblBoxText = m_myTransform.FindChild("OKCancelText").GetComponentsInChildren <UILabel>(true)[0]; } if (!m_okButton) { m_okButton = m_myTransform.FindChild("OKButton").GetComponent <MogoUIBtn>(); } if (!m_cancelButton) { m_cancelButton = m_myTransform.FindChild("CancelButton").GetComponent <MogoUIBtn>(); } m_okButton.ClickEvent = OnOKButtonUp; m_cancelButton.ClickEvent = OnCancelButtonUp; //m_lblOKBtnText = m_myTransform.FindChild("OKButton/OKButtonText").GetComponentsInChildren<UILabel>(true)[0]; //m_lblCancelBtnText = m_myTransform.FindChild("CancelButton/CancelButtonText").GetComponentsInChildren<UILabel>(true)[0]; if (!m_spOKBgUp) { m_spOKBgUp = m_myTransform.FindChild("OKButton/ImgNormal").GetComponentsInChildren <UISprite>(true)[0]; } if (!m_spOKBgDown) { m_spOKBgDown = m_myTransform.FindChild("OKButton/ImgPressed").GetComponentsInChildren <UISprite>(true)[0]; } if (!m_spCancelBgUp) { m_spCancelBgUp = m_myTransform.FindChild("CancelButton/ImgNormal").GetComponentsInChildren <UISprite>(true)[0]; } if (!m_spCancelBgDown) { m_spCancelBgDown = m_myTransform.FindChild("CancelButton/ImgPressed").GetComponentsInChildren <UISprite>(true)[0]; } //Debug.LogError("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ awake"); //if (!m_isInForwardLoading) //{ // m_goMessageBoxCamera = m_myTransform.parent.parent.parent.parent.FindChild("MessageBoxCamera").gameObject; // m_goMessageBoxCamera.SetActive(false); //} if (!m_isInForwardLoading) { gameObject.SetActive(false); } }
private void OnBtnCreate(MogoUIBtn btn) { if (CheckNameError()) { return; } string serverIp = MogoWorld.CreateServer(); MogoWorld.IsSingleMatch = true; MogoWorld.ConnectServer(serverIp, 43998); MogoWorld.Login(); MogoWorld.ServerIP = serverIp; }
private void OnSelectSoldierAction(MogoUIBtn btn) { GameObject selectSign = btn.gameObject.transform.FindChild("SelectSign").gameObject; selectSign.SetActive(!selectSign.activeSelf); if (selectSign.activeSelf == true) { StarInfoController.getInstance().FightSoldierIdList.Add((int)btn.IDUint64); } else { StarInfoController.getInstance().FightSoldierIdList.Remove((int)btn.IDUint64); } }
void OnDestroy() { m_lblBoxText = null; m_okButton = null; m_cancelButton = null; //m_lblOKBtnText = null; //m_lblCancelBtnText = null; m_spOKBgUp = null; m_spOKBgDown = null; m_spCancelBgUp = null; m_spCancelBgDown = null; m_myTransform = null; m_goMessageBoxCamera = null; }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.BattleUI.FindChild("Left"); SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(50, 60, 0); m_btnLock = FindComponent <MogoUIBtn>("BtnLock"); m_btnLock.ClickAction = OnBtnLock; m_goKeyCode = FindTransform("KeyCode").gameObject; m_goKeyCode.transform.FindChild("LblKeyCode").GetComponent <UILabel>().text = LanguageData.GetContent(150); SetKeyCodeActive(); AddListeners(); }
private void OnBtnScanJoin(MogoUIBtn btn) { if (CheckNameError()) { return; } #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); jo.Call("OpenQrCodeScanActivity"); } #endif }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0f, 0f, 0f); m_labContent = FindComponent <UILabel>("ContentText"); m_labBtnOkText = FindComponent <UILabel>("BtnOkText"); m_btnOk = FindComponent <MogoUIBtn>("BtnOk"); m_labBtnOkText.text = LanguageData.GetContent(3); m_btnOk.ClickAction = OnClickOk; m_btnCancel = FindComponent <MogoUIBtn>("BtnCancel"); FindComponent <UILabel>("BtnCancelText").text = LanguageData.GetContent(4); m_btnCancel.ClickAction = OnClickCanCel; }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/BottomRight"); SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(-70f, 22f, 0); m_myTransform.localScale = new Vector3(1.0f, 1.0f, 1f); var btnXuQi = FindComponent <MogoUIBtn>("EufloriaBarrierUIStartBtn"); btnXuQi.SetText(LanguageData.GetContent(155)); m_btnStart = FindComponent <MogoUIBtn>("EufloriaBarrierUIStartBtn"); m_btnStart.ClickAction = OnBtnStart; AddListeners(); }
private void OnBtnFind(MogoUIBtn btn) { if (CheckNameError()) { return; } //test if (UIManager.I.GetUILogic <WaitingUIMgr>().bShow) { UIManager.I.CloseUI <WaitingUIMgr>(); EventDispatcher.TriggerEvent(FindServerEvent.FindServerStop); } else { UIManager.I.ShowUI <WaitingUIMgr>(); EventDispatcher.TriggerEvent(FindServerEvent.FindServerStart); } }
protected override void OnResourceLoaded() { /*var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/BottomRight"); * SyncCreateUIInstanceWithRootTransform(Resources[0], parent); * m_myTransform.localPosition = new Vector3(-70f, 22f, 0); * m_myTransform.localScale = new Vector3(1.0f, 1.0f, 1f); */ var parent = MogoWorld.m_uiManager.MogoMainUIPanel; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0f, 0f, 0f); m_btnJoin = FindComponent <MogoUIBtn>("EufloriaBtnJoin"); m_btnJoin.SetText(LanguageData.GetContent(11)); m_btnJoin.ClickAction = OnBtnJoin; AddListeners(); }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoTopUIPanel.FindChild("TopUI/Center");; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); CurTimeTxt = FindTransform("CurTimeTxt").GetComponent <UILabel>(); PreTimeTxt = FindTransform("PreTimeTxt").GetComponent <UILabel>(); LoadingBg = FindTransform("LoadingBg").GetComponent <UISprite>(); CurTimeTxt.text = LanguageData.GetContent(189); timeId = TimerHeap.AddTimer(100, 100, ShowLoading); TimerHeap.Tick(); MogoUIBtn UIBtn = FindTransform("BtnCancel").GetComponent <MogoUIBtn>(); UIBtn.Text = LanguageData.GetContent(4); UIBtn.ClickAction = OnClickCancel; }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_uiManager.MogoMainUIPanel.FindChild("BattleUI/Center");; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); m_myTransform.localPosition = new Vector3(0, -312, -10); m_myTransform.localScale = new Vector3(1.0f, 1.0f, 1f); //显示建筑列表 SoldierTypeList = new List <MogoUIBtn>(); Transform soldierBg = FindTransform("ImgBg"); SoldierList = FindTransform("SoldierList").gameObject; MogoUIBtn soldierType = FindTransform("SoldierType").GetComponent <MogoUIBtn>(); int i = 0; foreach (SoldierData data in SoldierData.dataMap.Values) { GameObject copyBuildingsBg = GameObject.Instantiate(soldierBg.gameObject) as GameObject; GameObject copyBuildingType = GameObject.Instantiate(soldierType.gameObject) as GameObject; copyBuildingsBg.transform.parent = SoldierList.transform; copyBuildingType.transform.parent = SoldierList.transform; copyBuildingsBg.transform.localScale = new Vector3(80, 80, 80); copyBuildingsBg.SetActive(true); copyBuildingType.transform.localScale = new Vector3(1, 1, 1); copyBuildingType.SetActive(true); copyBuildingsBg.transform.localPosition = new Vector3(i * 85, 0, 0); copyBuildingType.transform.localPosition = new Vector3(i * 85, 0, 0); MogoUIBtn btn = copyBuildingType.GetComponent <MogoUIBtn>(); btn.IDUint64 = (ulong)data.id; SoldierTypeList.Add(btn); SoldierTypeList[i].SetText(LanguageData.GetContent(data.name)); var copyBuildingTypeButton = copyBuildingType.GetComponent <MogoUIBtn>(); copyBuildingTypeButton.m_imgNormal.spriteName = data.icon; copyBuildingTypeButton.m_imgPressed.spriteName = data.icon; btn.ClickAction = OnSelectSoldierAction; i++; } SetStatus(); AddListeners(); }
protected override void InitUnitData() { if (UIBtn == null) { UIBtn = UnitGO.transform.FindChild("StarModel/StarBtn").GetComponent <MogoUIBtn>(); UIBtn.ClickAction = OnClickStar; m_BanBGOB = UnitGO.transform.FindChild("StarModel/BanBG").gameObject; BelongTo = StarBelongTo; } UnitGO.transform.parent = UnitParent; UnitGO.transform.localScale = new Vector3(1, 1, 1); UnitGO.transform.localPosition = new Vector3(PositionX, PositionY, 0); UnitGO.transform.FindChild("StarModel").localScale = new Vector3(BaseData.radius * 2, BaseData.radius * 2, -2);//两倍后才接近真实大小 UnitGO.transform.FindChild("StarModel/StarBtn").GetComponent <BoxCollider>().size = Vector3.one; m_starInfoUIMgr = UIManager.I.GetUILogic <StarInfoUIMgr>(); InitDrawings(); StarColor = UnitGO.transform.FindChild("StarColor").GetComponent <UISprite>(); StarColor.transform.localScale = new Vector3(BaseData.radius * 2, BaseData.radius * 2, 1);//两倍后才接近真实大小 StarColor.gameObject.SetActive(false); UIBtn.m_imgNormal.spriteName = BaseData.icon; UIBtn.m_imgPressed.spriteName = BaseData.icon; TweenRotation.Begin(UIBtn.m_imgNormal.gameObject, MogoWorld.GameTime, Quaternion.Euler(new Vector3(0, 0, Utils.CreateRandom().Next(90, 270)))); //得到星球上建筑的位置 BuildingPositionList = MapUtil.GetBuildingPosList(this, BaseData.count); //得到士兵在星球上的位置 SoliderPositionList = MapUtil.GetBuildingPosList(this, 6, BaseData.radius * 1.5f); if (CallBack != null) { CallBack(); CallBack = null; } }
public override void OnInspectorGUI() { EditorGUIUtility.LookLikeControls(80f); mMogoButton = target as MogoUIBtn; EditorGUILayout.Space(); GUILayout.BeginHorizontal(); var m_imgNormal = EditorGUILayout.ObjectField("m_imgNormal", mMogoButton.m_imgNormal, typeof(UISprite), GUILayout.Width(250f)) as UISprite; if (m_imgNormal != mMogoButton.m_imgNormal) { RegisterUndo(); mMogoButton.m_imgNormal = m_imgNormal; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var m_imgPressed = EditorGUILayout.ObjectField("m_imgPressed", mMogoButton.m_imgPressed, typeof(UISprite), GUILayout.Width(250f)) as UISprite; if (m_imgPressed != mMogoButton.m_imgPressed) { RegisterUndo(); mMogoButton.m_imgPressed = m_imgPressed; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var m_lblText = EditorGUILayout.ObjectField("m_lblText", mMogoButton.m_lblText, typeof(UILabel), GUILayout.Width(250f)) as UILabel; if (m_lblText != mMogoButton.m_lblText) { RegisterUndo(); mMogoButton.m_lblText = m_lblText; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var m_boxCollider = EditorGUILayout.ObjectField("m_boxCollider", mMogoButton.m_boxCollider, typeof(BoxCollider), GUILayout.Width(250f)) as BoxCollider; if (m_boxCollider != mMogoButton.m_boxCollider) { RegisterUndo(); mMogoButton.m_boxCollider = m_boxCollider; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var buttonType = (ButtonClickSoundType)EditorGUILayout.EnumPopup("buttonType", mMogoButton.buttonType, GUILayout.Width(170f)); if (buttonType != mMogoButton.buttonType) { RegisterUndo(); mMogoButton.buttonType = buttonType; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("一秒变样式", GUILayout.Width(75f)); //if (GUILayout.Button("底纹", GUILayout.Width(50f))) // ExportScenesManager.SetUINormalButton(mMogoButton.gameObject); //if (GUILayout.Button("确定", GUILayout.Width(50f))) // ExportScenesManager.SetUIOKButton(mMogoButton.gameObject); //if (GUILayout.Button("确定(小)", GUILayout.Width(50f))) // ExportScenesManager.SetUIOKSmallButton(mMogoButton.gameObject); //GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); //GUILayout.Label("", GUILayout.Width(75f)); //if (GUILayout.Button("取消", GUILayout.Width(50f))) // ExportScenesManager.SetUICancelButton(mMogoButton.gameObject); //if (GUILayout.Button("关闭", GUILayout.Width(50f))) // ExportScenesManager.SetUICloseButton(mMogoButton.gameObject); //if (GUILayout.Button("充值", GUILayout.Width(50f))) // ExportScenesManager.SetUIChargeButton(mMogoButton.gameObject); GUILayout.EndHorizontal(); }
private void OnBtnJump(MogoUIBtn btn) { }
private void OnBtnFly(MogoUIBtn btn) { }