private void SetAwardItem(List <PrizeItemConfig> items) { if (items == null || items.Count <= 0) { NGUITools.SetActive(goAwardItem, false); } else { PrizeItemConfig prizeItemCfg = items[0]; if (prizeItemCfg != null) { if (lblRankingAwardItem != null) { lblRankingAwardItem.text = "X " + prizeItemCfg.ItemNum; } int itemId = prizeItemCfg.ItemId; ItemConfig itemCfg = ItemConfigProvider.Instance.GetDataById(itemId); if (itemCfg == null) { return; } UnityEngine.Texture tex = CrossObjectHelper.TryCastObject <UnityEngine.Texture>(ResourceSystem.GetSharedResource(itemCfg.m_ItemTrueName)); if (texRankingAwardItem != null) { if (tex != null) { texRankingAwardItem.mainTexture = tex; } NGUITools.SetActive(goAwardItem, true); } } } }
public IEnumerator PlayEffectBody() { yield return(new WaitForSeconds(playTimeBody)); try { if (effectBody != null) { UnityEngine.GameObject efL = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(effectBody)); if (efL != null && posBodyL != null) { efL.transform.position = new UnityEngine.Vector3(posBodyL.transform.position.x, posBodyL.transform.position.y, posBodyL.transform.position.z); Destroy(efL, duration); } UnityEngine.GameObject efR = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(effectBody)); if (efR != null && posBodyR != null) { efR.transform.Rotate(0f, 180f, 0f); efR.transform.position = new UnityEngine.Vector3(posBodyR.transform.position.x, posBodyR.transform.position.y, posBodyR.transform.position.z); Destroy(efR, duration); } } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
UnityEngine.GameObject GetAGameObject() { if (gridGo != null) { int count = gridGo.transform.childCount; for (int i = 0; i < count; ++i) { UnityEngine.Transform tf = gridGo.transform.GetChild(i); if (tf != null) { if (!CheckAlreadyUsed(tf.gameObject)) { return(tf.gameObject); } } } UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Store/Item")); go = NGUITools.AddChild(gridGo, go); if (go != null) { return(go); } } return(null); }
void NewLockScene(bool isLock, int sceneId) { if (!isLock && UICurrentChapter.m_UnLockNextScene) { if (sceneId == UIDataCache.Instance.curUnlockSceneId || sceneId == UIDataCache.Instance.curMasterUnlockSceneId) { UIDataCache.Instance.justLogin = false; return; } else { switch (m_SubType) { case SubSceneType.Common: UIDataCache.Instance.curUnlockSceneId = sceneId; break; case SubSceneType.Master: UIDataCache.Instance.curMasterUnlockSceneId = sceneId; break; } if (UIDataCache.Instance.justLogin) { UIDataCache.Instance.justLogin = false; return; } } if (effectClone == null) { effectClone = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/DefenseEffect/SceneUnlockEffect")); effectClone = NGUITools.AddChild(gameObject, effectClone); } } }
// Use this for initialization void Start() { try { m_Particle = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("Hero_FX/1_Swordman/ui_FX_01")); UnityEngine.Transform tf = gameObject.transform.Find("Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { System.Int64.TryParse(ul.text, out num); //maxgrade = Grade(num); } } time = -1.0f; nowgrade = ""; tf = gameObject.transform.Find("Sprite0"); if (tf != null) { UISprite us = tf.gameObject.GetComponent <UISprite>(); if (us != null) { width = us.width; us.spriteName = null; } } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
//添加新手指引指示 public void AddGuidePointing(SlotType slotType, int skillId) { string path = UIManager.Instance.GetPathByName("GuideHand"); UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(path)); if (go == null) { Debug.Log("!!!Load " + path + " failed."); return; } if (slotType == SlotType.SkillStorage) { DelGuidePointOnUnlock(); if (uiSkillSetting != null) { uiSkillSetting.DelGuidePointing(-1); } if (uiSkillStorage != null) { uiSkillStorage.AddGuidePointing(go, skillId); } } else { if (uiSkillSetting != null) { uiSkillSetting.AddGuidePointing(go, -1); //如果没有第二步,只存在第一步到第三步则需要去掉Storage中的指示 if (uiSkillStorage != null) { uiSkillStorage.DelGuidePointing(skillId); } } } }
/*添加item*/ void AddItem(GroupMemberInfo member) { if (null != member) { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Team/member")); ItemShow(member, go); if (null != go) { UnityEngine.Transform tf = gameObject.transform.Find("bc/sp_heikuang/ScrollView/Grid"); if (null != tf) { go = NGUITools.AddChild(tf.gameObject, go); if (null != go) { switch (currTable) { case 1: teamDic.Add(go, member); break; case 2: confirmDic.Add(go, member); break; } SetItemInfo(go, member); } } } } }
void BuyMoneyTip(int num) { string path = UIManager.Instance.GetPathByName("GoldBuyDlg"); UnityEngine.Object obj = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.NewObject(path, 5f)); UnityEngine.GameObject go = obj as UnityEngine.GameObject; if (null != go) { UnityEngine.Transform tf = go.transform.Find("Label/value"); if (tf != null) { UILabel bloodPanel = tf.gameObject.GetComponent <UILabel>(); if (null != bloodPanel) { bloodPanel.text = num.ToString(); } } UnityEngine.GameObject cube = null; tf = transform.parent.Find("ScreenTipPanel"); if (tf != null) { cube = NGUITools.AddChild(tf.gameObject, obj); } if (cube != null) { BloodAnimation ba = cube.GetComponent <BloodAnimation>(); if (ba != null) { ba.PlayAnimation(); } NGUITools.SetActive(cube, true); } } }
// Use this for initialization void Start() { try { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource("UI/SelectCreateHero")); if (go != null) { Instantiate(go); } if (MainCamera.CameraOriginalPosition == UnityEngine.Vector3.zero) { MainCamera.CameraOriginalPosition = UnityEngine.Camera.main.transform.position; MainCamera.CameraOriginalRotation = UnityEngine.Camera.main.transform.rotation; } else { UnityEngine.Camera.main.transform.position = MainCamera.CameraOriginalPosition; UnityEngine.Camera.main.transform.rotation = MainCamera.CameraOriginalRotation; } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
private void AddWingGo(ItemConfig item_data, int itemId, int append_property, bool hasOwn) { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GamePokey/WingCell")); if (gridWingTop != null) { if (go != null) { go = NGUITools.AddChild(gridWingTop.gameObject, go); // geng xin item WingItem wi = go.GetComponent <WingItem>(); if (wi != null) { int fs = (int)GetItemFightScore(item_data, append_property, 1); wi.SetItemInformation(itemId, append_property, fs, true); } //记录物品id ItemClick ic = go.GetComponent <ItemClick>(); if (ic != null) { ic.ID = itemId; ic.PropertyId = append_property; } //添加物品后更改控件名,便于后续工作 go.transform.name = "Item" + itemcount++; } } }
public void UnlockSkill(SkillCategory category, bool isActive, SkillLogicData skillData = null) { try { int index = GetIndexByGroup(category); if (-1 != index) { string goPath = "Skill" + index.ToString(); //NGUIDebug.Log(this.name); if (SkillBarView != null) { UnityEngine.Transform ts = SkillBarView.transform.Find(goPath); if (null != ts) { UnityEngine.GameObject go = ts.gameObject; if (skillData != null) { ts = go.transform.Find("skill0"); if (ts != null) { UISprite sp = ts.gameObject.GetComponent <UISprite>(); UIButton btn = ts.GetComponent <UIButton>(); UnityEngine.GameObject goAtlas = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(skillData.ShowAtlasPath)); if (goAtlas != null) { UIAtlas atlas = goAtlas.GetComponent <UIAtlas>(); if (atlas != null && sp != null) { sp.atlas = atlas; } } else { Debug.LogError("!!!Load atlas failed."); } if (btn != null && sp != null) { btn.normalSprite = skillData.ShowIconName; sp.spriteName = skillData.ShowIconName; } } } if (isActive) { SetActive(isActive); } NGUITools.SetActive(go, isActive); } else { Debug.Log("!!can not find " + goPath); } } } } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
// Use this for initialization void Start() { try { AddSubscribe(); AddPointing(); teamMemberHead1 = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Team/TeamMemberHead")); teamMemberHead2 = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Team/TeamMemberHead")); UnityEngine.Transform tf = transform.Find("UIPanel_1/UIAnchor-TopLeft"); teamMemberHead1 = NGUITools.AddChild(tf.gameObject, teamMemberHead1); aMemberFlag = teamMemberHead1.transform.Find("leader"); teamMemberHead2 = NGUITools.AddChild(tf.gameObject, teamMemberHead2); teamMemberHead1.transform.localPosition = new UnityEngine.Vector3(70f, -183, 0f); teamMemberHead2.transform.localPosition = new UnityEngine.Vector3(70f, -283, 0f); NGUITools.SetActive(teamMemberHead1.gameObject, false); NGUITools.SetActive(teamMemberHead2.gameObject, false); hpProgressBar1 = teamMemberHead1.transform.Find("HeroView-HpBar").gameObject.GetComponent <UIProgressBar>(); hpProgressBar2 = teamMemberHead2.transform.Find("HeroView-HpBar").gameObject.GetComponent <UIProgressBar>(); hpProgressBar1.value = 1f; hpProgressBar2.value = 1f; roleInfo = LobbyClient.Instance.CurrentRole; if (roleInfo.Group.Count > 0) { SetMemberShow(); } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
public void ShowReliveUi() { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Relive")); if (null != go) { go = NGUITools.AddChild(m_FatherGo, go); } }
/*设置texAnimation图片*/ private void SetTexAnimaitionImage(string path, UITexture texAnimation) { UnityEngine.Texture tex = CrossObjectHelper.TryCastObject <UnityEngine.Texture>(ArkCrossEngine.ResourceSystem.GetSharedResource(path)); if (tex != null && texAnimation != null) { texAnimation.mainTexture = tex; } }
// 播放特效 void PlayEffect(ChangJingEffect.OpenSceneType type, string name, int chapter = 0, int section = 0) { UnityEngine.Object effect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.NewObject(goEffect)); UnityEngine.GameObject go = NGUITools.AddChild(this.gameObject, effect); ChangJingEffect changjing = go.GetComponent <ChangJingEffect>(); changjing.OpenEffectType(type, name, chapter, section); }
// 播放区域清除特效0:小clear 1:大 void PlayAreaEffect(int type) { UnityEngine.Object effect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(clearEffect)); UnityEngine.GameObject go = NGUITools.AddChild(this.gameObject, effect); StageClearEffect stageClear = go.GetComponent <StageClearEffect>(); stageClear.OpenEffectType(type); }
void OnGetNewThings(NewThings newThings) { getNewThings = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Common/GetNewThings")); //UnityEngine.Transform panel = transform.Find("UIPanel_1"); //UIAnchor-Center getNewThings = NGUITools.AddChild(gameObject, getNewThings); GetNewThings getNewScript = getNewThings.GetComponent <GetNewThings>(); getNewScript.InitPanel(newThings); }
void InitEffect() { runtimeEffect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.NewObject(goEffectTitle)); if (runtimeEffect != null && goTitle != null) { runtimeEffect.transform.position = goTitle.transform.position; } DestroyEffect(); }
//更新怒气值 public void UpdateAngryValue() { SharedGameObjectInfo share_info = LogicSystem.PlayerSelfInfo; if (share_info != null) { float value = share_info.Rage / share_info.MaxRage; float spTempValue = value; if (value > 0.9f && value < 1f) { //让玩家更容易分辨出当前为怒气未满状态 spTempValue = 0.9f; } if (spAgeryValueEx != null) { spAgeryValueEx.fillAmount = spTempValue; } //增加一个判断条件:等loading界面结束 if (value >= 1 && spFullEx != null && UIDataCache.Instance.isLoadingEnd) { if (NGUITools.GetActive(spAshEx.gameObject) && m_IsInNewbieGuide == false) { //第一次释放技能,需要新手引导 m_IsInNewbieGuide = true; m_IsNeedLockGameFrame = true; SetLockFrame(true); } if (spAgeryValueEx != null) { spAgeryValueEx.fillAmount = 1f; } NGUITools.SetActive(spFullEx.gameObject, true); //播放特效 if (goEffect != null && m_RuntimeEffect == null && spAshEx != null && NGUITools.GetActive(spAshEx.gameObject)) { m_RuntimeEffect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(goEffect)); if (m_RuntimeEffect != null) { m_RuntimeEffect.transform.position = spFullEx.transform.position; } } } else { if (spFullEx != null) { NGUITools.SetActive(spFullEx.gameObject, false); if (m_RuntimeEffect != null) { Destroy(m_RuntimeEffect); m_RuntimeEffect = null; } } } } }
// 防御关卡播放特效 type = 0,1,2,3(被击,防御,挑战,突袭) void PlayDefenseEffect(int type) { UnityEngine.Object ob = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(defensEffect)); UnityEngine.GameObject go = UIManager.Instance.GetWindowGoByName("FightUI"); UnityEngine.Transform defensPanel = go.transform.Find("UIPanel_3/UIAnchor-Center"); UnityEngine.GameObject effect = NGUITools.AddChild(defensPanel.gameObject, ob); DefenseEffect defenseEffectScript = effect.GetComponent <DefenseEffect>(); defenseEffectScript.InitType(type); }
//播放解锁特效 public void PlayUnlockEffect() { if (effectClone == null) { effectClone = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/DefenseEffect/SkillUnlockEffect")); effectClone = NGUITools.AddChild(gameObject, effectClone); effectClone.transform.localPosition = transform.Find("unlock").localPosition; ; } }
private void PlayParticle(UnityEngine.GameObject posGo) { if (effect != null && posGo != null) { UnityEngine.GameObject ef = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(effect)); if (ef != null) { ef.transform.position = posGo.transform.position; Destroy(ef, duration); } } }
public void PlayEffectCount() { if (effectCount != null) { UnityEngine.GameObject ef = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(effectCount)); if (ef != null && posCount != null) { ef.transform.position = new UnityEngine.Vector3(posCount.transform.position.x, posCount.transform.position.y, posCount.transform.position.z); Destroy(ef, duration); } } }
/*添加好友*/ void AddFriend(ArkCrossEngine.FriendInfo friendInfo) { if (null != friendInfo) { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Friend/Friend")); UnityEngine.Transform tf = gameObject.transform.Find("sp_heikuang/ScrollView/Grid"); if (null != tf) { go = NGUITools.AddChild(tf.gameObject, go); if (null != go) { friendDic.Add(go, friendInfo); SetFriendItemInfo(go, friendInfo); } } //玩家不在线 if (null != go) { UnityEngine.Transform transform; UISprite us; if (!friendInfo.IsOnline) { transform = go.transform.Find("DI2"); if (null != transform) { us = transform.gameObject.GetComponent <UISprite>(); if (null != us) { us.spriteName = "bg_2"; } } HideCompent(go, "liaotian"); HideCompent(go, "zudui"); HideCompent(go, "AddFriend"); } else { transform = go.transform.Find("DI2"); if (null != transform) { us = transform.gameObject.GetComponent <UISprite>(); if (null != us) { us.spriteName = "backgroud"; } } ShowCompent(go, "liaotian"); ShowCompent(go, "zudui"); } } } }
//在说话的角色头上播放特效 private void PlayParticleByUnitId(int unitId) { //20001代表玩家的UnitId if (unitId == 20001) { //玩家说话 UnityEngine.GameObject obj = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(LogicSystem.PlayerSelf); PlayParticleByGameObject(obj); return; } //NPC说话 LogicSystem.PublishLogicEvent("ge_switch_actorid", "game", unitId); }
void AddPointItem() { UnityEngine.GameObject item = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/PartnerPvp/RankingCell")); if (item != null) { RankingCell cell = item.GetComponent <RankingCell>(); if (cell != null) { cell.InitItemInfo(null); } } item = NGUITools.AddChild(masterGrid.gameObject, item); itemList.Add(item); }
public void LoadAllWindows(UISceneType sceneType, UnityEngine.Camera cam) { if (null == m_RootWindow) { return; } foreach (UiConfig info in uiConfigDataDic.Values) { if (info.m_ShowType != (int)(UILoadType.DontLoad) && info.m_OwnToSceneList.Contains((int)sceneType)) { //Debug.Log(info.m_WindowName); UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource(info.m_WindowPath)); if (go == null) { Debug.Log("!!!Load ui " + info.m_WindowPath + " failed."); continue; } UnityEngine.GameObject child = NGUITools.AddChild(m_RootWindow, go); if (info.m_ShowType == (int)(UILoadType.Active)) { NGUITools.SetActive(child, true); if (!m_VisibleWindow.ContainsKey(info.m_WindowName)) { m_VisibleWindow.Add(info.m_WindowName, child); } } else { NGUITools.SetActive(child, false); if (!m_UnVisibleWindow.ContainsKey(info.m_WindowName)) { m_UnVisibleWindow.Add(info.m_WindowName, child); } } UnityEngine.Vector3 screenPos = CalculateUiPos(info.m_OffsetLeft, info.m_OffsetRight, info.m_OffsetTop, info.m_OffsetBottom); if (!m_IsLoadedWindow.ContainsKey(info.m_WindowName)) { m_IsLoadedWindow.Add(info.m_WindowName, child); } if (null != child && cam != null) { child.transform.position = cam.ScreenToWorldPoint(screenPos); } } } IsUIVisible = true; }
public void OnShowStarFinished() { UnityEngine.GameObject runtimeEffect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(goEffectStar)); if (runtimeEffect != null) { m_RunTimeEffectList.Add(runtimeEffect); if (m_StarFinishedCount < spStarsArr.Length && spStarsArr[m_StarFinishedCount] != null) { runtimeEffect.transform.position = spStarsArr[m_StarFinishedCount].transform.position; } } if (++m_StarFinishedCount == m_StarCount) { StartCoroutine(ShowMasterAward()); } }
void Start() { try { UnityEngine.GameObject runtimeEffect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(goEffectTitle)); if (runtimeEffect != null && goTitle != null) { runtimeEffect.transform.position = goTitle.transform.position; m_RunTimeEffectList.Add(runtimeEffect); } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
//设置左侧进阶技能信息 public void SetLeftSkillInfo(int parterId, int stage) { PartnerInfo info = GetPartnerInfoById(parterId); if (info != null) { PartnerConfig ptCfg = PartnerConfigProvider.Instance.GetDataById(info.Id); if (ptCfg != null) { List <string> iconList = new List <string>(); iconList.Add(ptCfg.Icon0); iconList.Add(ptCfg.Icon1); iconList.Add(ptCfg.Icon2); iconList.Add(ptCfg.Icon3); UIAtlas atlas = null; UnityEngine.GameObject goAtlas = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(ptCfg.AtlasPath)); if (goAtlas != null) { atlas = goAtlas.GetComponent <UIAtlas>(); } for (int index = 0; index < spSkillLifts.Length; ++index) { if (spSkillLifts[index] != null && index < iconList.Count) { spSkillLifts[index].atlas = atlas; spSkillLifts[index].spriteName = iconList[index]; } if (stage >= index + 1) { spSkillLifts[index].color = WhiteColor; if (spSkillLocks[index] != null) { NGUITools.SetActive(spSkillLocks[index].gameObject, false); } } else { spSkillLifts[index].color = AshColor; if (spSkillLocks[index] != null && !NGUITools.GetActive(spSkillLocks[index].gameObject)) { NGUITools.SetActive(spSkillLocks[index].gameObject, true); } } } } } }