protected override void Load(ScriptableData.CallData callData) { if (callData.GetParamNum() >= 3) { m_StartTime = long.Parse(callData.GetParamId(0)); m_RemainTime = long.Parse(callData.GetParamId(1)); string materialname = callData.GetParamId(2); Material material = ResourceSystem.GetSharedResource(materialname) as Material; if (material != null) { m_SBMRemain = material; } } }
//技能开关上添加、删除指引图标 private void AddPointingToSkill(bool canUnlock) { if (canUnlock) { if (!hasAdded) { string path = UIManager.Instance.GetPathByName("Pointing"); UnityEngine.GameObject go = ResourceSystem.GetSharedResource(path) as UnityEngine.GameObject; if (null != go) { UnityEngine.GameObject goFather = GetBtnGameObject("Entrance-Skill"); if (goFather != null) { UnityEngine.GameObject parent = new UnityEngine.GameObject(); parent = NGUITools.AddChild(pointingParent, parent); parent.transform.localPosition = goFather.transform.localPosition; parent.name = goFather.name; AddBtsPointing(parent); go = NGUITools.AddChild(parent, go); UISprite sp = goFather.GetComponent <UISprite>(); if (sp != null) { go.transform.localPosition = new UnityEngine.Vector3(sp.width / 3f, sp.height / 3f, 0); } go.name = "Pointing"; hasAdded = true; // TweenPosition tween = go.GetComponent<TweenPosition>(); // if(tween!=null){ // tween.from = go.transform.localPosition; // UnityEngine.Vector3 pos = go.transform.localPosition; // tween.to = new UnityEngine.Vector3(pos.x,pos.y+5,0); // tween.enabled = true; // } } } } } else { //UnityEngine.GameObject goFather = GetBtnGameObject("Entrance-Skill"); if (pointingParent != null) { RemoveBtsPointing("Entrance-Skill"); //UnityEngine.Transform tween = pointingParent.transform.Find("Entrance-Skill"); //if (tween != null) NGUITools.Destroy(tween.gameObject); } } }
private byte[] LoadGameResource(ref string resource) { string fileName = resource + ".lua"; TextAsset text = ResourceSystem.GetSharedResource(fileName) as TextAsset; if (text != null) { // for debugger resource = ScriptManager.Instance.GetLuaScriptPathForDebugger(resource, true); return(System.Text.Encoding.UTF8.GetBytes(text.text)); } else { return(null); } }
public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime) { GameObject obj = sender as GameObject; if (null == obj) { return(false); } if (!m_IsResourcePreloaded) { PreloadResource(obj, instance); } if (curSectionTime < m_StartTime) { return(true); } if (m_IsNeedCollide) { SkillDamageManager damage_manager = instance.CustomDatas.GetData <SkillDamageManager>(); if (damage_manager == null || !damage_manager.IsDamagedEnemy) { return(false); } } string random_audio = GetRandomAudio(); AudioClip clip = ResourceSystem.GetSharedResource(random_audio) as AudioClip; if (null == clip) { return(false); } if (m_AudioSource != null) { if (m_AudioSource.loop) { m_AudioSource.clip = clip; m_AudioSource.Play(); } else { m_AudioSource.PlayOneShot(clip); } m_AudioSource.volume = m_volume; m_AudioSource.dopplerLevel = 0f; } return(false); }
public static void PlaySound(GameObject obj, string sound) { if (null != obj) { AudioSource audioSource = obj.GetComponent <AudioSource>(); if (null != audioSource) { AudioClip clip = ResourceSystem.GetSharedResource(sound) as AudioClip; if (null != clip) { audioSource.clip = clip; audioSource.dopplerLevel = 0; audioSource.Play(); } } } }
/*添加组队提示*/ void AddPointing() { string path = UIManager.Instance.GetPathByName("Pointing"); pointing = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(path)); if (null != pointing) { if (team != null) { pointing = NGUITools.AddChild(team.gameObject, pointing); UISprite sp = team.GetComponent <UISprite>(); if (sp != null) { pointing.transform.localPosition = new UnityEngine.Vector3(sp.width / 3f + sp.height / 3f, 0); } pointing.name = "Pointing"; } NGUITools.SetActive(pointing, false); } }
public void GuidePointToUnlock(int skillId) { if (uiSkillStorage != null) { uiSkillStorage.DelGuidePointing(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; } DelGuidePointOnUnlock(); UnityEngine.Transform transUnlock = this.transform.Find("SkillInfo/02LevelUpInfo/bt"); if (transUnlock != null) { NGUITools.AddChild(transUnlock.gameObject, go); } }
//添加新手指引指示 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); } } } }
//设置左侧进阶技能信息 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); } } } } } }
public void SetSellGain(string money, string diamond) { sign = TaskAwardOpenForWindow.W_SellGain; for (int i = 0; i < golist.Count; i++) { if (golist[i] != null) { NGUITools.DestroyImmediate(golist[i]); } } /* * foreach (UnityEngine.GameObject go in golist) { * if (go != null) { * NGUITools.DestroyImmediate(go); * } * }*/ golist.Clear(); UnityEngine.Transform tfb = transform.Find("Back"); if (tfb != null) { if (money != null) { UnityEngine.GameObject go = ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName("UI/GoodsPhoto/Money"); UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { if (utt != null) { ut.mainTexture = utt; } } UnityEngine.Transform tf = go.transform.Find("Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = money; } } } } } if (diamond != null) { UnityEngine.GameObject go = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName("UI/GoodsPhoto/Diamond"); UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { if (utt != null) { ut.mainTexture = utt; } } UnityEngine.Transform tf = go.transform.Find("Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = diamond; } } } } } } int number = golist.Count; if (number == 0) { return; } int offset = 0; int start = 0; if (number % 2 != 0) { UnityEngine.GameObject go = golist[0]; if (go != null) { go.transform.localPosition = new UnityEngine.Vector3(0.0f, 25f, 0.0f); start = 1; offset = 50; } } else { offset = -60; } for (int i = start; i < number; ++i) { int j = i; if (number % 2 == 0) { j = i + 1; } UnityEngine.GameObject go = golist[i]; if (go != null) { if (j % 2 == 0) { go.transform.localPosition = new UnityEngine.Vector3(j / 2 * (-120) - offset, 25, 0); } else { go.transform.localPosition = new UnityEngine.Vector3((j / 2 + 1) * 120 + offset, 25, 0.0f); } } } }
public void SetItemInformation(int _id, int propertyid, int fightScore, bool hasOwn) { ItemConfig item_data = ItemConfigProvider.Instance.GetDataById(_id); if (item_data == null) { return; } id = _id; propertyId = propertyid; pos = 7; if (lblName != null) { lblName.text = item_data.m_ItemName; UnityEngine.Color col; switch (item_data.m_PropertyRank) { case 1: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; case 2: col = new UnityEngine.Color(0x00 / 255f, 0xfb / 255f, 0x4a / 255f); break; case 3: col = new UnityEngine.Color(0x41 / 255f, 0xc0 / 255f, 0xff / 255f); break; case 4: col = new UnityEngine.Color(0xff / 255f, 0x00 / 255f, 0xff / 255f); break; case 5: col = new UnityEngine.Color(0xff / 255f, 0xa3 / 255f, 0x00 / 255f); break; default: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; } lblName.color = col; } if (spIcon != null) { UnityEngine.Texture tex = CrossObjectHelper.TryCastObject <UnityEngine.Texture>(ResourceSystem.GetSharedResource(item_data.m_ItemTrueName)); spIcon.mainTexture = tex; } if (spKuang != null) { spKuang.spriteName = "EquipFrame" + item_data.m_PropertyRank; } if (lblFingtScore != null) { lblFingtScore.text = fightScore.ToString(); } if (btnBuy != null && btnEquip != null && goHasEquip != null) { bool hasEquip = HasEquipThis(id); NGUITools.SetActive(btnEquip.gameObject, !hasEquip); NGUITools.SetActive(goHasEquip, hasEquip); } if (btnBuy != null) { NGUITools.SetActive(btnBuy.gameObject, !hasOwn); } }
//添加可操作提示 private void AddAnyActionHint() { if (!m_HintHavenAdded) { string path = UIManager.Instance.GetPathByName("Pointing"); UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(path)); if (null != go) { go = NGUITools.AddChild(this.gameObject, go); UISprite sp = this.GetComponent <UISprite>(); if (sp != null) { go.transform.localPosition = new UnityEngine.Vector3(sp.width / 3f, sp.height / 3f, 0); } go.name = C_RunTimeGoName; } m_HintHavenAdded = true; } }
public void SetIconAtlas(int skillId) { SkillLogicData skillCfg = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_SKILL, skillId) as SkillLogicData; //m_SkillInfo = info; if (null != skillCfg) { UnityEngine.GameObject goAtlas = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(skillCfg.ShowAtlasPath)); if (goAtlas != null) { UIAtlas atlas = goAtlas.GetComponent <UIAtlas>(); if (atlas != null && icon != null) { icon.atlas = atlas; } } else { Debug.LogError("!!!Load atlas failed."); } } }
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 void SetLiftSkillInfo(PartnerConfig partnerCfg, int stage, int itemId) { if (partnerCfg == null) { return; } List <string> iconList = new List <string>(); if (iconList == null) { return; } iconList.Add(partnerCfg.Icon0); iconList.Add(partnerCfg.Icon1); iconList.Add(partnerCfg.Icon2); iconList.Add(partnerCfg.Icon3); List <string> DescList = new List <string>(); if (DescList == null) { return; } DescList.Add(partnerCfg.StageDescription0); DescList.Add(partnerCfg.StageDescription1); DescList.Add(partnerCfg.StageDescription2); DescList.Add(partnerCfg.StageDescription3); UIAtlas atlas = null; UnityEngine.GameObject goAtlas = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(partnerCfg.AtlasPath)); if (goAtlas != null) { atlas = goAtlas.GetComponent <UIAtlas>(); } for (int index = 0; index < c_SkillNumMax; ++index) { if (spLift[index] != null && index < iconList.Count) { spLift[index].spriteName = iconList[index]; spLift[index].atlas = atlas; } //设置技能图标 if (lblLifts[index] != null && index < DescList.Count) { lblLifts[index].text = DescList[index]; } if (stage >= index + 1) { spLift[index].color = LightColor; } else { spLift[index].color = AshColor; } //设置进阶箭头 if (index < spArrow.Length && spArrow[index] != null) { if (stage > index + 1) { spArrow[index].spriteName = "sheng-ji-jian-tou1"; } else { spArrow[index].spriteName = "sheng-ji-jian-tou2"; } } if (stage >= index + 1) { lblLifts[index].color = SectionColor; } else { lblLifts[index].color = AshColor; } } m_PartnerSkillLiftUpItemId = itemId; DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Partner_Skill, goSkillLift, itemId); if (stage < 4) { //if (textureLiftGoods != null) NGUITools.SetActive(textureLiftGoods.gameObject, true); if (lblLiftItemNum != null) { NGUITools.SetActive(lblLiftItemNum.gameObject, true); } if (btnLiftUp != null) { NGUITools.SetActive(btnLiftUp.gameObject, true); } int itemNeedNum = 0; ItemConfig itemCfg = ItemConfigProvider.Instance.GetDataById(itemId); if (itemCfg != null) { PartnerStageUpConfig stageUpCfg = PartnerStageUpConfigProvider.Instance.GetDataById(stage); if (stageUpCfg != null) { itemNeedNum = stageUpCfg.ItemCost; } int ownItemNum = GetItemNum(itemId); if (lblLiftItemNum != null) { lblLiftItemNum.text = ownItemNum + "/" + itemNeedNum; } if (itemProgressBar != null && itemNeedNum != 0) { itemProgressBar.value = ownItemNum / (float)itemNeedNum; } bool enable = (ownItemNum >= itemNeedNum); EnableButton(btnLiftUp, enable); } } else { string CHN = StrDictionaryProvider.Instance.GetDictString(359); if (lblLiftItemName != null) { lblLiftItemName.text = CHN; } if (itemProgressBar != null) { itemProgressBar.value = 1; } if (btnLiftUp != null) { NGUITools.SetActive(btnLiftUp.gameObject, false); } //if (textureLiftGoods != null) NGUITools.SetActive(textureLiftGoods.gameObject, false); if (lblLiftItemNum != null) { NGUITools.SetActive(lblLiftItemNum.gameObject, false); } } }
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 { 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); } }
public void SetSomething(int money, int diamond, int exp, List <int> itemlist, List <int> itemcount) { for (int i = 0; i < golist.Count; i++) { if (golist[i] != null) { NGUITools.DestroyImmediate(golist[i]); } } /* * foreach (UnityEngine.GameObject go in golist) { * if (go != null) { * NGUITools.DestroyImmediate(go); * } * }*/ golist.Clear(); UnityEngine.Transform tfb = transform.Find("Back"); if (tfb != null) { if (money > 0) { UnityEngine.GameObject go = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Task_Award, go, DFMItemIconUtils.Instance.m_Money, money); } } } if (diamond > 0) { UnityEngine.GameObject go = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Task_Award, go, DFMItemIconUtils.Instance.m_Diamond, diamond); } } } if (exp > 0) { UnityEngine.GameObject go = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Task_Award, go, DFMItemIconUtils.Instance.m_Exp, exp); } } } int count = itemlist.Count; for (int i = 0; i < count; ++i) { UnityEngine.GameObject go = ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Task_Award, go, itemlist[i], itemcount[i]); } } } } int number = golist.Count; if (number == 0) { return; } int offset = 0; int start = 0; if (number % 2 != 0) { UnityEngine.GameObject go = golist[0]; if (go != null) { go.transform.localPosition = new UnityEngine.Vector3(0.0f, 25f, 0.0f); start = 1; offset = 50; } } else { offset = -60; } for (int i = start; i < number; ++i) { int j = i; if (number % 2 == 0) { j = i + 1; } UnityEngine.GameObject go = golist[i]; if (go != null) { if (j % 2 == 0) { go.transform.localPosition = new UnityEngine.Vector3(j / 2 * (-120) - offset, 25, 0); } else { go.transform.localPosition = new UnityEngine.Vector3((j / 2 + 1) * 120 + offset, 25f, 0.0f); } } } AddEffect(golist); }