void Update() { if (!begin_) { return; } if (aimObj_ == null) { return; } float len = Mathf.PingPong(Time.time * speed_, 1f); len *= wave_; Vector2 dest = new Vector2(originPos_.x + forward_.x * len, originPos_.y + forward_.y * len); if (!isLocalPos_) { transform.position = new Vector2(aimObj_.transform.position.x + offsetX_, aimObj_.transform.position.y + offsetY_); effect_.transform.position = aimObj_.transform.position; } else { Vector3 uiPos = GlobalInstanceFunction.WorldToUI(aimObj_.transform.position); transform.localPosition = new Vector2(uiPos.x + offsetX_, uiPos.y + offsetY_); } arrowsImg.transform.localPosition = dest; }
public void Show(string content, GameObject obj, NpcHeadChatUI.DestroyHandler callback, string combieParam, float time) { if (obj == null) { return; } //if (!npcObjList.Contains(obj)) //{ // npcObjList.Add(obj); GameObject clone = (GameObject)GameObject.Instantiate(panelObj_); UIPanel rootPane = ApplicationEntry.Instance.uiRoot.GetComponent <UIPanel>(); clone.transform.parent = rootPane.transform; clone.transform.localScale = Vector3.one; Vector3 Objpos = obj.transform.position; Objpos = new Vector3(Objpos.x, Objpos.y + obj.transform.GetComponent <BoxCollider>().size.y, Objpos.z); Vector3 pos = GlobalInstanceFunction.WorldToUI(Objpos); pos = new Vector3(pos.x, pos.y + 80, pos.z); clone.transform.localPosition = pos; //clone.GetComponent<Destroy> ().CancelInvoke (); NpcHeadChatUI nhcUI = clone.GetComponent <NpcHeadChatUI>(); nhcUI.textLab.text = content; nhcUI.SetParam(callback, combieParam); Destroy des = clone.AddComponent <Destroy>(); if (Mathf.Approximately(time, 0f)) { des.lifetime = content.Length * 0.5f; } else { des.lifetime = time; } chatUIObjList.Add(clone); for (int i = 0; i < chatUIObjList.Count; ++i) { if (chatUIObjList[i] == null) { chatUIObjList.RemoveAt(i); } } //} }
public static void LoadingScene(string name) { GameManager.Instance.EnableDelayCheck(false); GuideManager.Instance.ClearMask(); ApplicationEntry.Instance.switchSceneMask_.SetActive(true); UIManager.Instance.DoDeActive(); Prebattle.Instance.ClearAssetLoadCount(); GlobalInstanceFunction.LoadSceneUI(name, () => { Application.LoadLevel(name); }); }
public void BeginInScene(GameObject aimObj, float offsetX, float offsetY, GuidePointerRotateType rotateType, string str) { isLocalPos_ = true; wave_ = 60f; offsetX_ = offsetX; offsetY_ = offsetY; aimObj_ = aimObj; Vector3 uiPos = GlobalInstanceFunction.WorldToUI(aimObj_.transform.position); transform.localPosition = new Vector2(uiPos.x + offsetX, uiPos.y + offsetY); originPos_ = arrowsImg.transform.localPosition; Set(rotateType, str); }
void SetEnityUIPosition() { for (int i = 0; i < EntityObjs.Count; i++) { if (null == EntityObjs[i]) { continue; } Vector3 pos = EntityObjs[i].transform.position; pos.y -= 0.2f; lstEntityUI[i].transform.localPosition = GlobalInstanceFunction.WorldToUI(pos); } }
void SetCreateBtnPos() { if (createP == null) { return; } if (posIndex < cRole.playerPos.Length) { createP.transform.parent = gameObject.transform; createP.transform.localPosition = GlobalInstanceFunction.WorldToUI(cRole.playerPos[posIndex].position); createP.transform.localScale = Vector3.one; createP.gameObject.SetActive(true); } }
void Update() { if (Name == null) { ClientLog.Instance.Log("Name is null...................."); return; } if (!hasDestroyed && Name) { Name.transform.localPosition = GlobalInstanceFunction.WorldToUI(gameObject.transform.position); } if (!hasDestroyed && Title) { Title.transform.LookAt(Camera.main.transform); } }
public void SetrolesPanle(int insID) { for (int i = 0; i < gos.Count; i++) { if (gos[i] == null) { continue; } if (int.Parse(gos[i].name) == insID) { RolePanelObj.SetActive(true); RolePanelObj.transform.localPosition = GlobalInstanceFunction.WorldToUI(gos[i].transform.parent.position); RolePanelObj.transform.localScale = Vector3.one; //RolePanelObj.transform.localPosition = new Vector3(RolePanelObj.transform.position.x,RolePanelObj.transform.position.y-160,0); } } SetPlayerInfo(insID); }
private void Poptext(int v, PropertyType type, bool isCrit = false) { char [] nums = v.ToString().ToCharArray(); UISprite sp; TweenPosition tp; TweenScale ts; for (int i = 0; i < nums.Length; i++) { int index = int.Parse(nums[i].ToString()); sp = GameObject.Instantiate(spN) as UISprite; sp.transform.gameObject.SetActive(true); tp = sp.GetComponent <TweenPosition>(); ts = sp.GetComponent <TweenScale>(); sp.transform.parent = transform; sp.transform.localPosition = GlobalInstanceFunction.WorldToUI(new Vector3(GetRoleObj().transform.position.x, (GetRoleObj().transform.position.y + GetRoleObj().collider.bounds.size.y) + 0.3f, GetRoleObj().transform.position.z)); sp.transform.localPosition = new Vector2(sp.transform.localPosition.x + i * (sp.localSize.x + 10), sp.transform.position.y + 300); sp.transform.localScale = Vector3.one; if (type.Equals(PropertyType.PT_MpCurr)) { sp.spriteName = diaoNums[index]; } else { if (isPlus) { sp.spriteName = aspiriNums0[index]; } else { sp.spriteName = iconNames [index]; } } sp.MakePixelPerfect(); tp.from = new Vector2(sp.transform.position.x + i * (sp.localSize.x), sp.transform.position.y + 300); tp.to = new Vector2(sp.transform.position.x + i * (sp.localSize.x), sp.transform.position.y + 400); tp.enabled = true; ts.enabled = isCrit; Destroy(sp.gameObject, 1); } }
public GameObject CreatePlayerUI(BattleActor entity, bool hideBar) { if (null == entity) { return(null); } if (entity.ControlEntity == null) { ApplicationEntry.Instance.PostSocketErr(57557); return(null); } GameObject EntityObj = entity.ControlEntity.ActorObj; GameObject pre = GameObject.Instantiate(HUD) as GameObject; pre.SetActive(true); pre.transform.parent = transform; //hudRoot.transform; Vector3 battlepos = Vector3.zero; if (entity != null) { Transform point = Battle.Instance.GetStagePointByIndex(entity.BattlePos); if (point != null) { battlepos = point.position; } } battlepos.y -= 0.2f; pre.transform.localPosition = GlobalInstanceFunction.WorldToUI(battlepos); pre.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); Roleui rui = pre.GetComponent <Roleui> (); rui.SetRoleObj(EntityObj); rui.InitData(entity); rui.hp.gameObject.SetActive(!hideBar); rui.mp.gameObject.SetActive(!hideBar); pre.name = GlobalValue.ActorUIObjName + entity.InstId; lstEntityUI.Add(pre); EntityObjs.Add(EntityObj); return(pre); }
void Start() { //GamePlayer.Instance.OnQuestUpdate += ChangeFuHao; //ChangeFuHao (); InitData(); QuestSystem.OnQuestUpdate += OnQuestUpdate; GamePlayer.Instance.PlayerLevelUpEvent += OnLevelUp; OnQuestUpdate(); Name = (GameObject.Instantiate(ApplicationEntry.Instance.nameLabel) as GameObject).GetComponent <UILabel>(); Name.transform.parent = ApplicationEntry.Instance.uiRoot.transform; Name.transform.localPosition = GlobalInstanceFunction.WorldToUI(gameObject.transform.position); Name.transform.localScale = Vector3.one; UISprite vip = Name.transform.GetComponentInChildren <UISprite>(); vip.gameObject.SetActive(false); NpcData ndata = NpcData.GetData(NpcId); Name.text = string.Format("[b]{0}[-]", ndata.Name); TalkData talk = TalkData.GetData(ndata.NpcTalk); if (talk != null && talk.BattleId != 0) { Name.color = new Color32(255, 144, 0, 255); } else { Name.color = new Color32(66, 255, 253, 255); } if (Application.loadedLevelName.Equals(GlobalValue.StageName_JiazuPkScene)) { bool isEnemyGuildMonster = familyMonsterData.isEnemyGuildMonster(GameManager.Instance.isLeft, NpcId); if (isEnemyGuildMonster) { Name.color = GlobalValue.RED; } } hasDestroyed = false; }
// Use this for initialization void Start() { inst = this; if (GameManager.Instance != null) { GameManager.Instance.SetChatUIActive(false); } destroyed = false; if (OnBeginLoading != null) { OnBeginLoading(); } SceneData sdata = SceneData.GetData(GameManager.SceneID); if (sdata == null) { scenenicon = "loding"; } else { scenenicon = sdata.scene_icon; } HeadIconLoader.Instance.LoadIcon(scenenicon, back); ui_loaded_ = !StageMgr.withUI_; dynamicResLoaded_ = !StageMgr.withDynRes_; manualCloseUI_ = StageMgr.manualClose_; // 注册loading形式 LoadingProgressbar progressbar = GetComponentInChildren <LoadingProgressbar>(); progressbar.UseThisType(); //加载场景模型 SceneLoader.Instance.LoadScene(StageMgr.Scene_name, () => { StartCoroutine(loading()); }); //加载UI资源 GlobalInstanceFunction.LoadSceneUI(StageMgr.Scene_name, UILoadFinish); Resources.UnloadUnusedAssets(); }
void Start() { int mucId = 0; if (Battle.Instance.battleType == BattleType.BT_PVE) { if (Battle.Instance.BattleID == 0) { GlobalValue.Get(Constant.C_BossMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } else { GlobalValue.Get(Constant.C_PutnMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } } else if (Battle.Instance.battleType == BattleType.BT_PVP) { GlobalValue.Get(Constant.C_PvpMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } HideAttackType(); levelLabel.text = GamePlayer.Instance.Properties [(int)PropertyType.PT_Level].ToString(); HeadIconLoader.Instance.LoadIcon("R_" + EntityAssetsData.GetData((int)GamePlayer.Instance.Properties [(int)PropertyType.PT_AssetId]).assetsIocn_, palyIcon); HUD.SetActive(false); attackNumSp.transform.gameObject.SetActive(false); closeSkillWindow(); closeSkillTwoWindow(); ClosePetWindow(); lstEntityUI = new List <GameObject>(); GameObject pos = GameObject.Find("CenterPoint"); if (pos == null) { return; } CountDownG.transform.localPosition = GlobalInstanceFunction.WorldToUI(pos.transform.position); tempstr = playernanmeLabel.text; BagSystem.instance.UpdateItemEvent += OnItemUpdate; BagSystem.instance.DelItemInstEvent += OnItemDelete; BagSystem.instance.ItemChanged += OnItemAdd; BagSystem.instance.BattleOpenBagEvent += new RequestEventHandler <bool>(OpenBagEvent); UIManager.Instance.showMainPanelEnvent += new RequestEventHandler <bool>(AttackPanelShow); UpdateItemCount(); buttons.Add(attackBtn); buttons.Add(skillBtn); buttons.Add(DefenseBtn); buttons.Add(PosBtn); buttons.Add(AUTOBtn); buttons.Add(ArticleBtn); buttons.Add(petBtn); buttons.Add(fleeBtn); buttons.Add(catchBtn); UIManager.SetButtonEventHandler(teamBtn.gameObject, EnumButtonEvent.OnClick, teamBtnClick, 0, 0); UIManager.SetButtonEventHandler(zihyinBtn.gameObject, EnumButtonEvent.OnClick, zihyinBtnClick, 0, 0); UIManager.SetButtonEventHandler(renwuBtn.gameObject, EnumButtonEvent.OnClick, OnClickrenwuBtn, 0, 0); UIManager.SetButtonEventHandler(skilliBtn.gameObject, EnumButtonEvent.OnClick, OnClickskilliBtn, 0, 0); //UIManager.SetButtonEventHandler (bagaBtn.gameObject, EnumButtonEvent.OnClick, OnClickbagaBtn, 0, 0); UIManager.SetButtonEventHandler(shopBtn.gameObject, EnumButtonEvent.OnClick, OnClickshopBtn, 0, 0); UIManager.SetButtonEventHandler(famBtn.gameObject, EnumButtonEvent.OnClick, OnClickfamBtn, 0, 0); UIManager.SetButtonEventHandler(huodongBtn.gameObject, EnumButtonEvent.OnClick, OnClickhuodongBtn, 0, 0); UIManager.SetButtonEventHandler(jincaBtn.gameObject, EnumButtonEvent.OnClick, OnClickjincaBtn, 0, 0); UIManager.SetButtonEventHandler(backBtn.gameObject, EnumButtonEvent.OnClick, BackClick, 0, 0); UIManager.SetButtonEventHandler(PlayerBackBtn.gameObject, EnumButtonEvent.OnClick, PlayerBackClick, 0, 0); UIManager.SetButtonEventHandler(catchBtn.gameObject, EnumButtonEvent.OnClick, OnClickCatchBtn, 0, 0); UIManager.SetButtonEventHandler(attackBtn.gameObject, EnumButtonEvent.OnClick, OnClickattackBtn, 0, 0); UIManager.SetButtonEventHandler(skillBtn.gameObject, EnumButtonEvent.OnClick, OnClickskillBtn, 0, 0); UIManager.SetButtonEventHandler(DefenseBtn.gameObject, EnumButtonEvent.OnClick, OnClickDefenseBtn, 0, 0); UIManager.SetButtonEventHandler(PosBtn.gameObject, EnumButtonEvent.OnClick, OnClickPosBtn, 0, 0); UIManager.SetButtonEventHandler(AUTOBtn.gameObject, EnumButtonEvent.OnClick, OnClickAUTOBtn, 0, 0); UIManager.SetButtonEventHandler(ArticleBtn.gameObject, EnumButtonEvent.OnClick, OnClickArticleBtn, 0, 0); UIManager.SetButtonEventHandler(petBtn.gameObject, EnumButtonEvent.OnClick, OnClickpetBtn, 0, 0); UIManager.SetButtonEventHandler(fleeBtn.gameObject, EnumButtonEvent.OnClick, OnClickfleeBtn, 0, 0); UIManager.SetButtonEventHandler(CanAUTOBtn.gameObject, EnumButtonEvent.OnClick, OnClickCanAUTO, 0, 0); UIManager.SetButtonEventHandler(speedUpBtn_.gameObject, EnumButtonEvent.OnClick, OnSpeedUpBtn, 0, 0); UIManager.SetButtonEventHandler(playerActionBtn.gameObject, EnumButtonEvent.OnClick, OnPlayerActionBtn, 0, 0); UIManager.SetButtonEventHandler(petActionBtn.gameObject, EnumButtonEvent.OnClick, OnPetActionBtn, 0, 0); UIManager.SetButtonEventHandler(babyHUD.gameObject, EnumButtonEvent.OnClick, OnShowBaby, 0, 0); UIEventListener.Get(playeroBJ).onClick = OnOpenPlayer; AutoPlayerPanel.GetComponent <ChangeAutoOrder>().operatType_ = OperateType.OT_P1; AutoPetPanel.GetComponent <ChangeAutoOrder>().operatType_ = OperateType.OT_B; curHp = GamePlayer.Instance.GetIprop(PropertyType.PT_HpCurr); curMp = GamePlayer.Instance.GetIprop(PropertyType.PT_MpCurr); if (GamePlayer.Instance.BattleBaby != null) { curHpbb = GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_HpCurr); curMpbb = GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_MpCurr); } speedUpBtn_.normalSprite = Battle.Instance.speedUpOn_ ? speedUpImg : normalImg; if (GuildSystem.IsInGuild()) { famBtn.isEnabled = true; UISprite sp = famBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); } else { UISprite sp = famBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); famBtn.isEnabled = false; } if (TeamSystem.IsInTeam()) { UISprite sp = teamBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); teamBtn.isEnabled = true; } else { UISprite sp = teamBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); teamBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Shop)) { UISprite sp = shopBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); shopBtn.isEnabled = true; } else { UISprite sp = shopBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); shopBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Guid)) { UISprite sp = zihyinBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); zihyinBtn.isEnabled = true; } else { UISprite sp = zihyinBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); zihyinBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Activity)) { UISprite sp = huodongBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); huodongBtn.isEnabled = true; } else { UISprite sp = huodongBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); huodongBtn.isEnabled = false; } if (GamePlayer.Instance.GetIprop(PropertyType.PT_Level) >= GamePlayer.Instance.openADActivityLv) { UISprite sp = jincaBtn.GetComponentInChildren <UISprite>(); if (GamePlayer.Instance.adTypes.Count == 0) { sp.color = new Color(0, 255, 0); jincaBtn.isEnabled = false; } if (GamePlayer.Instance.adTypes.Count > 0) { sp.color = new Color(255, 255, 255); jincaBtn.isEnabled = true; } } else { UISprite sp = jincaBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); jincaBtn.isEnabled = false; } GuideManager.Instance.RegistGuideAim(attackBtn.gameObject, GuideAimType.GAT_BattleAttack); GuideManager.Instance.RegistGuideAim(skillBtn.gameObject, GuideAimType.GAT_BattleSkill); GuideManager.Instance.RegistGuideAim(AUTOBtn.gameObject, GuideAimType.GAT_BattleAuto); GuideManager.Instance.RegistGuideAim(ArticleBtn.gameObject, GuideAimType.GAT_BattleBag); GuideManager.Instance.RegistGuideAim(catchBtn.gameObject, GuideAimType.GAT_BattleCatch); GuideManager.Instance.RegistGuideAim(playerActionBtn.gameObject, GuideAimType.GAT_PlayerAuto); GlobalInstanceFunction.Instance.UpdatecounDownTime += attackEvent; if (GuideManager.Instance.InBattleGuide_) { CloseCountDown(); } AttaclEvent.getInstance.OnSetPanelActive += SetSelfActive; huiheObj.SetActive(false); hasDestroy = false; SetBabyInfo(); }
public static void LoadingAsyncScene(string name, SwitchScenEffect type = SwitchScenEffect.LoadingBar, bool withUI = true, bool withDynRes = false, bool manualClose = false, bool resetLocker = false) { if (GlobalValue.isBattleScene(name)) { GamePlayer.Instance.isInBattle = true; } else { GamePlayer.Instance.isInBattle = false; } GameManager.Instance.EnableDelayCheck(false); GuideManager.Instance.ClearMask(); GlobalInstanceFunction.Instance.ClearInvokeRepeat(); PlayerAsseMgr.ClearAll(); EffectAssetMgr.ClearAll(); Resources.UnloadUnusedAssets(); if (Loading || ScenePreloader.Instance.DiffSceneLoad(name)) { wait4LoadQue_.Clear(); WaitLoadInfo wli = new WaitLoadInfo(); wli.name_ = name; wli.type_ = type; wli.withUI_ = withUI; wli.withDynRes_ = withDynRes; wli.manualClose_ = manualClose; wli.resetLocker_ = resetLocker; wait4LoadQue_.Enqueue(wli); return; } Loading = true; if (resetLocker) { GameManager.Instance.reconnectionLocker_ = false; } ApplicationEntry.Instance.switchSceneMask_.SetActive(true); if (OnSceneBeginLoad != null) { OnSceneBeginLoad(); } UIManager.Instance.DoDeActive(); withUI_ = withUI; withDynRes_ = withDynRes; manualClose_ = manualClose; preScene_ = Scene_name; Scene_name = name; Loadtype = type; if (Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) { GameManager.Instance.ClearCurrentState(); } if (type == SwitchScenEffect.LoadingBar) { UIFactory.Instance.LoadUIPanel(UIASSETS_ID.UIASSETS_LoadingPanel, () => { UIFactory.Instance.CloseCurrentUI(); UIFactory.Instance.OpenUI(UIASSETS_ID.UIASSETS_LoadingPanel, menuTypes.Popup); ApplicationEntry.Instance.switchSceneMask_.SetActive(false); }); } else { GlobalInstanceFunction.LoadSceneUI(Scene_name, () => { ShowGame.Instance.ShowScenEffect(type); }); } Prebattle.Instance.ClearAssetLoadCount(); sendSceneLoaded_ = false; }