private static void ClearCombatScene() { if (m_MapStart != null) { U3DUtil.DestroyAllChild(m_MapStart.gameObject); } }
/// <summary> /// 显示传送点 /// </summary> /// <param name="grid"></param> public void ShowTranGate(Int2 grid) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { Vector3 vEndEff = Vector3.zero; if (RoomMap.CheckHaveMap() == true) { vEndEff = RoomMap.GetRoomGridLocalPos(grid); } else { vEndEff = GenerateShip.GetbuildPos(grid); } vEndEff = U3DUtil.AddX(vEndEff, 1.0f); if (go1903041) { go1903041.SetActive(true); go1903041.transform.localPosition = vEndEff; if (go1903041.GetComponent <NdHide>() != null) { go1903041.GetComponent <NdHide>().ResetDuration(3f); } } } }
/// <summary> /// 绘制导线 /// </summary> public void DrawLine() { Vector3 s = m_line.StartLineLeap.Link != null ? m_line.StartLineLeap.Link.transform.position : m_line.StartLineLeap.transform.position; Vector3 e = m_line.EndLineLeap.Link != null ? m_line.EndLineLeap.Link.transform.position : m_line.EndLineLeap.transform.position; bool change = CheckCtrlChange(s, m_MidCtrl.transform.position, e); if (m_lpoint.Count > 0) { if (change == true) { Vector3[] resultList = PointController.PointList(pathList, pointnum); for (int i = 0; i < resultList.Length; i++) { if (i == 0 && m_line.StartLineLeap.Link != null) { m_lpoint[0] = m_line.StartLineLeap.Link.transform.position; } else if (i == 0 && m_line.StartLineLeap.Link == null) { m_lpoint[0] = m_line.StartLineLeap.transform.position; } else { m_lpoint[i] = resultList[i]; } } if (m_line.EndLineLeap.Link != null) { m_lpoint[resultList.Length - 1] = m_line.EndLineLeap.Link.transform.position; } else { m_lpoint[resultList.Length - 1] = m_line.EndLineLeap.transform.position; } SetColloderPosition(); } } else { Vector3[] resultList = PointController.PointList(pathList, pointnum); for (int i = 0; i < resultList.Length; i++) { m_lpoint.Add(resultList[i]); } InitCollider(); m_fLineMiniDistance = U3DUtil.GetVectorListDistance(m_lpoint); } //if (CheckMiniDistance()) //{ // return; //} //循环100遍来绘制贝塞尔曲线每个线段 for (int i = 0; i < m_lpoint.Count; i++) { Vector3 vec = m_lpoint[i]; //把每条线段绘制出来 完成白塞尔曲线的绘制 Line.SetPosition(i, vec); Line.SetWidth(fwidth, fwidth); } }
/// <summary> /// 主菜单初始设定 /// </summary> void MainMenuInit() { m_bOpenMainMenu = false;//默认是关闭主菜单 if (MyHead.BtnClick) { MyHead.BtnClick.OnClickEventHandler += BtnClick_OnClickEventHandler; } if (MyHead.BtnWndBackground) { MyHead.BtnWndBackground.OnClickEventHandler += BtnWndBackground_OnClickEventHandler; } if (MyHead.GoTweenSprite) { Vector3 pos = MyHead.GoTweenSprite.transform.localPosition; if (m_bOpenMainMenu == true) { MyHead.GoTweenSprite.transform.localPosition = U3DUtil.SetY(pos, m_fMaxHeight); } else { MyHead.GoTweenSprite.transform.localPosition = U3DUtil.SetY(pos, m_fMinHeight); } } if (MyHead.LblFangAnName != null) { ShipPlan P = ShipPlanDC.GetCurShipPlan(); MyHead.LblFangAnName.text = P.Name; } }
/// <summary> /// 加载船上炮弹兵 /// </summary> public static void LoadShipPutSoldier(int ID, int DataID, SoldierInfo Info) { if (Info == null) { return; } Role r = new Role(); r.CreateSkin(GetLifeMBornNode(true), Info.m_modeltype, Info.m_name, AnimatorState.Stand, true); //IGameRole i = GameRoleFactory.Create(GetLifeMBornNode(true), Info.m_modeltype, Info.m_name, AnimatorState.Stand); GameObject go = r.RoleSkinCom.tRoot.gameObject; go.name = Info.m_name; Int2 BornPos = new Int2(Info.CX, Info.CY); go.transform.localPosition = RoomMap.GetShipBuildLocalPos(BornPos, ShipBuildType.Soldier); go.transform.localPosition = U3DUtil.SetZ(go.transform.localPosition, -2.0f); Transform tRole = go.transform.GetChild(0); TouchMove touch = tRole.gameObject.AddComponent <TouchMove>(); CanvasCore Core = new CanvasCore(ShipBuildType.Soldier, false, ID, DataID, Vector2.zero); touch.InitTouchMoveCore(Core, BornPos, null); AddBuildingEditPlugin(touch); if (Info.SoldierTypeID == 100003) //隐藏蹦蹦 //RolePropertyM rpm = i.GetBodyComponent<RolePropertyM>(); { r.RoleSkinCom.ShowLeftHand(false); } TouchMoveManager.JointShipBuild(touch); }
public void GoldCoinEffect(int num, int count) { for (int i = 0; i < num; i++) { Vector3 pos = MapGrid.GetMG(m_Attr.Pos).pos; //+new Vector3(Random.Range(1,m_Attr.Size*0.5f-2),-0.5f,1f); pos += new Vector3(0, 0.25f, 1.2f); pos = BattleEnvironmentM.Local2WorldPos(pos); int n = (int)count / num; if (i == 0) { n += count - num * ((int)count / num); } GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000041", EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); //EffectCamera.AddFollowList(gae.transform,pos); if (gae != null) { GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0)); gae.AddAction(gaw); GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI(); gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, ResourceType.Gold); gae.AddAction(gar); GameObject coin = U3DUtil.FindChild(gae.gameObject, "coin"); if (coin != null) { coin.GetComponent <ParticleSystem>().startDelay = Random.Range(1f, 1.5f); } } } }
/// <summary> /// 对于有召唤物的 处理 /// </summary> /// <param name="Info"></param> void KickSummonPet(FlyCollisionInfo Info) { if (Info.SummonPet != null) { //MapBoat._Mapboat.GetWorldPos(m_vhitJumpPos).x if (Info.SummonPet.transform.position.x <= m_Owner.m_thisT.position.x) { Info.HitDir = WalkDir.WALKLEFT; } else { Info.HitDir = WalkDir.WALKRIGHT; } Pet pet = Info.SummonPet.GetComponentInChildren <LifeProperty>().GetLife() as Pet; if (pet != null && pet.PetMoveAI is PetFly1002) { if ((pet.PetMoveAI as PetFly1002).m_bHitFloor) { //m_vhitJumpPos = pet.m_Skin.tRoot.localPosition; pet.m_Skin.tRoot.position = U3DUtil.SetY(pet.m_Skin.tRoot.position, m_Owner.m_Skin.tRoot.position.y); (pet.PetMoveAI as PetFly1002).KickBomb(Info.HitDir); } else { Info.m_flyFallStandState = AnimatorState.FlyFallStand00200; Object.Destroy(Info.SummonPet); } } } }
public void ReSetUI() { m_listAllTypeInfo = ItemDC.GetItemList(m_itemType); CreateItems(); //最后一个卖掉,显示其上一个内容. if (nSelectIndex == m_listAllTypeInfo.Count) { nSelectIndex = m_listAllTypeInfo.Count - 1; } if (nSelectIndex >= 0 && nSelectIndex < m_listAllTypeInfo.Count) { ItemTypeInfo info = m_listAllTypeInfo[nSelectIndex]; if (info != null && info.Num > 0) { RefreshIntorduct(info); return; } } ItemTypeInfo defaultInfo = GetDefaultInfo(); if (defaultInfo == null) { U3DUtil.DestroyAllChild(MyHead.ItemParent); return; } RefreshIntorduct(defaultInfo); }
/// <summary> /// 攻击范围 光效半圆环 /// </summary> /// <param name="isShow">是否显示</param> /// <param name="radius">攻击半径</param> public void ShowAttackRangeSemi(bool isShow, float radius = 1.0f) { if (isShow) { if (AttackRangeSemiCircle02 == null && AttackRangeSemiCircle01 == null) { AttackRangeSemiCircle01 = GameObjectLoader.LoadPath("effect/prefab/", "2000681_01", m_thisT); Vector3 pos = AttackRangeSemiCircle01.transform.position; AttackRangeSemiCircle01.transform.position = U3DUtil.AddX(pos, 1.5f); AttackRangeSemiCircle01.transform.Rotate(0, -180f, 0); GameObjectActionExcute gae = AttackRangeSemiCircle01.AddComponent <GameObjectActionExcute>(); GameObjectActionWait wait = new GameObjectActionWait(1 + Time.deltaTime, ShowSemiLoop); GameObjectActionDelayDestory fade = new GameObjectActionDelayDestory(1f); gae.AddAction(wait); gae.AddAction(fade); } } else { if (AttackRangeSemiCircle01) { GameObject.Destroy(AttackRangeSemiCircle01); } if (AttackRangeSemiCircle02) { GameObject.Destroy(AttackRangeSemiCircle02); } } }
/// <summary> /// 根据选取的背包类型创建物品. /// </summary> private void CreateItems() { // nSelectIndex = -1; U3DUtil.DestroyAllChild(MyHead.Parent); CreateAllItemsList();//临时 等待其他物品数据和资源 NGUIUtil.RepositionTable(MyHead.Parent); }
public void CreateSkin(Transform parent, int roleType, string roleName, AnimatorState aniState, bool isPlayer) { m_emAniState = aniState; IAnimatorStateRule rule = new AnimatorStateRule(aniState, false); m_nActionGroup = rule.GetAniGroup(); m_nRoleType = roleType; m_strRoleName = roleName; m_objParent = parent; GameObject go = new GameObject(); m_tRoot = go.transform; m_tRoot.parent = parent; m_tRoot.localPosition = new Vector3(0, 0, 0); m_tRoot.name = roleName; m_tbody = loadRole(m_tRoot, m_nRoleType, m_nActionGroup).transform; if (m_tbody != null) { if (ProPerty == null) { ProPerty = U3DUtil.GetComponentInChildren <RolePropertyM>(m_tRoot.gameObject, true); } } ChangeState(aniState); SetCampModel(isPlayer); }
IEnumerator RepositionTable(int frameCount) { yield return(StartCoroutine(U3DUtil.WaitForFrames(frameCount))); MyHead.Table.Reposition(); MyHead.Table.repositionNow = true; }
private void SetDraggedPosition(PointerEventData data) { Vector3 globalMousePos; CameraType type = m_labObject != null && m_labObject is EleLine ? CameraType.WireCamera : CameraType.LabCamera; LabCamera carme = LabEnv.GetCameraByType(type); if (carme != null && carme.ScreenPointToWorldPointInRectangle(m_DraggingPlane, data.position, out globalMousePos)) { Vector3 org = m_DraggingItem.transform.position; globalMousePos = U3DUtil.SetZ(globalMousePos, m_DraggingItem.transform.position.z); m_DraggingItem.transform.position = globalMousePos; if (m_labObject != null && m_labObject is EleLine) { bool startOut = carme.CheckPositionInCamera((m_labObject as EleLine).m_LineAction.m_StartCtrl.transform.position); bool EndOut = carme.CheckPositionInCamera((m_labObject as EleLine).m_LineAction.m_EndCtrl.transform.position); if (!startOut || !EndOut) { m_DraggingItem.transform.position = org; } } else if (!carme.CheckPositionInCamera(globalMousePos)) { m_DraggingItem.transform.position = org; } } }
public override void Start() { base.Start(); GameObject box = U3DUtil.FindChild(m_target, "box"); if (box != null) { box.SetActive(false); } GameObject go = GameObjectLoader.LoadPath("effect/prefab/", "2000601", m_target.transform); if (go != null) { GameObjectLoader.SetGameObjectLayer(go, LayerMask.NameToLayer("Resource")); ParticleSystem s = go.GetComponent <ParticleSystem>(); if (s != null) { s.Play(); } } m_itemTransform = SetEffect(m_itemtype, m_itemID); }
/// <summary> /// 设置镜像 /// </summary> public void SetEffectMirror(WalkDir dir) { if (dir == WalkDir.WALKRIGHT) { U3DUtil.SetMirror(gameObject, -1, 1, 1); } }
IEnumerator RepositionFinish(int frameCount) { yield return(StartCoroutine(U3DUtil.WaitForFrames(frameCount))); ResetPosition(); MyHead.DragBox.enabled = true; }
/// <summary> /// 飞行出蹦蹦 /// </summary> private void FlyPet() { DelHandPet(); Pet pet = new Pet(); pet.CreateSkin(m_Skin.tRoot.parent, 1002, "1002", AnimatorState.FlyClick00300, m_LifePrent.m_Core.m_IsPlayer); // IGameRole i = GameRoleFactory.Create(m_Skin.tRoot.parent, 1002, "1002", AnimatorState.FlyClick00300); GameObject goPet = pet.PetSkinCom.tRoot.gameObject; GameObject navelpos = m_Skin.ProPerty.HelpPoint.GetVauleByKey(HelpPointName.NavelPos); if (navelpos != null) { goPet.transform.position = navelpos.transform.position; } U3DUtil.SetZ(goPet.transform.position, -1f); LifeObj lo = goPet.AddComponent <LifeObj>(); m_FlyCollisionInfo.SummonPet = goPet; pet.SetBorn(m_LifePrent, 1002001, 1002, m_LifePrent.m_thisT.position); pet.SetSkin(); //pet.SetMoveState(MoveState.Fly); if (m_LifePrent is Role) { (m_LifePrent as Role).CurPet = pet; } lo.SetLife(pet, pet.PetSkinCom.ProPerty); }
public static void ReBuildShip() { U3DUtil.DestroyAllChild(m_MapStart.gameObject); Int2 roomGrid = new Int2(); switch (m_SceneState) { case TreasureState.None: case TreasureState.CanvasEdit: { ShipPlan plan = ShipPlanDC.GetCurShipPlan(); if (plan != null) { roomGrid = plan.Canvans.GetMapSize(); BattleEnvironmentM.ResetStartPos(plan.Canvans.GetMapSize(), true); } GenerateShip.GenerateShips(m_MapStart); break; } } Vector3 pos = MainCameraM.GetMainCameraPos(roomGrid); MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidBoatView); MainCameraM.s_Instance.AutoMoveTo(pos, 0f); }
private void CreateWhenSelectChange(AttributeType type) { m_iBtnTrapTypeIndex = type; List <BuildInfo> BuildList = new List <BuildInfo> (); List <BuildInfo> CanExitBuildList = new List <BuildInfo> (); List <BuildInfo> CanNotExitBuildList = new List <BuildInfo> (); switch (m_iBtnTrapTypeIndex) { case AttributeType.Gas: BuildList = GetBuildInfo(AttributeType.Gas, TrapState.Exit); CanExitBuildList = GetBuildInfo(AttributeType.Gas, TrapState.CanSum); CanNotExitBuildList = GetBuildInfo(AttributeType.Gas, TrapState.CanNotSum); break; case AttributeType.Electric: BuildList = GetBuildInfo(AttributeType.Electric, TrapState.Exit); CanExitBuildList = GetBuildInfo(AttributeType.Electric, TrapState.CanSum); CanNotExitBuildList = GetBuildInfo(AttributeType.Electric, TrapState.CanNotSum); break; case AttributeType.Poison: BuildList = GetBuildInfo(AttributeType.Poison, TrapState.Exit); CanExitBuildList = GetBuildInfo(AttributeType.Poison, TrapState.CanSum); CanNotExitBuildList = GetBuildInfo(AttributeType.Poison, TrapState.CanNotSum); break; case AttributeType.Water: BuildList = GetBuildInfo(AttributeType.Water, TrapState.Exit); CanExitBuildList = GetBuildInfo(AttributeType.Water, TrapState.CanSum); CanNotExitBuildList = GetBuildInfo(AttributeType.Water, TrapState.CanNotSum); break; case AttributeType.Fire: BuildList = GetBuildInfo(AttributeType.Fire, TrapState.Exit); CanExitBuildList = GetBuildInfo(AttributeType.Fire, TrapState.CanSum); CanNotExitBuildList = GetBuildInfo(AttributeType.Fire, TrapState.CanNotSum); break; case AttributeType.ALL: BuildList = m_Build; CanExitBuildList = m_CanSumBuild; CanNotExitBuildList = m_CannotSumBuild; break; } U3DUtil.DestroyAllChild(MyHead.Parent); CreateTrap(CanExitBuildList, TrapState.CanSum); CreateTrap(BuildList, TrapState.Exit); CreateTrap(CanNotExitBuildList, TrapState.CanNotSum); SetTrapCount(BuildList.Count); NGUIUtil.RepositionTable(MyHead.Parent); MyHead.Anchor.enabled = true; StartCoroutine(RepositionFinish(2)); // MyHead.Anchor.runOnlyOnce = true; }
/// <summary> /// 图鉴 /// </summary> public void TogTuJian_OnValueChange() { if (!MyHead.BtnTuJian.value) { return; } U3DUtil.DestroyAllChild(MyHead.SprTrapIntorduct as UnityEngine.GameObject); }
private void ClearUI() { U3DUtil.DestroyAllChild(MyHead.Parent.gameObject); m_NoExistSoldier.Clear(); m_CanExistSoldier.Clear(); m_ExistSoldier.Clear(); }
/// <summary> /// 技能已满级的时候UI设定 /// </summary> IEnumerator RepostionLblCoin() { yield return(U3DUtil.WaitForFrames(1)); Vector3 pos = MyHead.LblCoin.transform.localPosition; MyHead.LblCoin.transform.localPosition = U3DUtil.AddX(pos, -50f); }
void ClearUI() { WndManager.DestoryDialog <AddSkillWnd>(); if (MyHead.EquipmentsParent) { U3DUtil.DestroyAllChild(MyHead.EquipmentsParent); } }
private void ShowSemiLoop(object o) { AttackRangeSemiCircle02 = GameObjectLoader.LoadPath("effect/prefab/", "2000681_02", m_thisT); Vector3 pos = AttackRangeSemiCircle02.transform.position; AttackRangeSemiCircle02.transform.position = U3DUtil.AddX(pos, 1.5f); AttackRangeSemiCircle02.transform.Rotate(0, -180f, 0); }
void BtnReturn_OnClickEventHandler(UIButton sender) { U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject); WndManager.DestroyAllDialogs(); BoatObj.SendGetPlanData(); TreasureScene.OutTreasureScene(); }
/// <summary> /// 清空头像列表 /// </summary> private void EmptyCapHeadList(GameObject Parent) { if (Parent == null) { return; } m_CaptionList.Clear(); U3DUtil.DestroyAllChild(Parent); }
public virtual void DoStateAction(LabObjectState state) { //设置完好或损毁表现 if (ShowMaterial == null || ShowTextures.Length != Enum.GetNames(typeof(LabObjectState)).Length) { return; } U3DUtil.ChangeTexture(ShowMaterial, ShowTextures[(int)state]); }
private void HideHandPet() { GameObject go = U3DUtil.FindChildDeep(m_Skin.tRoot.gameObject, "1002@skin"); if (go) { go.SetActive(false); } }
/// <summary> /// 显示/删除 状态特效 /// </summary> /// <param name="type">眩晕、冰冻、压扁、击飞、麻痹、死亡</param> public void ShowStatusEffect(StatusType type, float duration) { if (CombatScheduler.State == CSState.End) { return; } string name = ""; switch (type) { case StatusType.Vertigo: //眩晕 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); name = "2000691_02"; break; case StatusType.IceBuild: //冰冻 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); name = "2000691_01"; break; case StatusType.Squash: //压扁 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); name = "2000691_05"; break; case StatusType.ClickFly: //击飞 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); name = "2000691_03"; break; case StatusType.paralysis: //麻痹 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); name = "2000691_04"; break; case StatusType.Die: //死亡 U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); NGUIUtil.Change2DSpriteGray(m_soldierItem.MyHead.SprRolePhoto); break; case StatusType.None: U3DUtil.DestroyAllChild(MyHead.StatusEffectParent, true); break; default: break; } if (name != "") { GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", name, MyHead.StatusEffectParent.transform.position, MyHead.StatusEffectParent.transform); gae.gameObject.AddComponent <SetRenderQueue>(); GameObjectActionDelayDestory delay = new GameObjectActionDelayDestory(duration); gae.AddAction(delay); } }
public void SetData(int prelevel, int afterlevel, string explain) { UISprite[] starSprites = U3DUtil.GetComponentsInChildren <UISprite>(MyHead.lblPreStar); NGUIUtil.SetStarLevelNum(starSprites, prelevel); starSprites = U3DUtil.GetComponentsInChildren <UISprite>(MyHead.lblAfterStar); NGUIUtil.SetStarLevelNum(starSprites, afterlevel); MyHead.lblExplain.text = explain; }