private void Awake() { titleControls = GameObject.Find ("Canvas"); btnStart = titleControls.GetComponentInChildren<Button> (); btnStart.onClick.AddListener (() => btnOnclick ()); inputField = titleControls.GetComponentInChildren<InputField> (); }
public void SetMaster(GameObject mas) { master = mas; healthGUI = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Enemies/healthObj")); Image health = healthGUI.GetComponentInChildren<Image>(); Text healthtext = healthGUI.GetComponentInChildren<Text>(); if (gameObject.transform.position.x < 0) { health.transform.localPosition = new Vector3(-40, (Screen.height / Screen.dpi) + 80, gameObject.transform.localPosition.z); healthtext.transform.localPosition = new Vector3(-25, (Screen.height / Screen.dpi) + 75, gameObject.transform.localPosition.z); } else { health.transform.localPosition = new Vector3(45, (Screen.height / Screen.dpi) + 80, gameObject.transform.localPosition.z); healthtext.transform.localPosition = new Vector3(66, (Screen.height / Screen.dpi) + 75, gameObject.transform.localPosition.z); } //health.transform.localPosition = new Vector3(gameObject.transform.localPosition.x * 13 + 11f, (Screen.height/Screen.dpi) +80, gameObject.transform.localPosition.z); //healthtext.transform.localPosition = new Vector3(gameObject.transform.localPosition.x *12 + 14, (Screen.height / Screen.dpi) + 75, gameObject.transform.localPosition.z); healthtxt = healthtext; healthbar = health; //if the forgottone if(gameObject.name== "Forgotten(Clone)0") { spinner1 = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Enemies/Forgottonspinner1")); spinner2 = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Enemies/ForgottonSpinner2")); spinner1.transform.localScale = new Vector3 (1.4f,1.3f,1); spinner2.transform.localScale = new Vector3 (1.4f,1.3f,1); } }
public void Selected(GameObject card) { card.transform.SetSiblingIndex (9); card.GetComponent<RectTransform>().sizeDelta = new Vector2(m_CardWidth * 0.9f, m_CardHeight * 0.9f); m_Servant = card.tag; if (card.GetComponentInChildren<Text>()) { m_IntroText.GetComponent<Text>().text = card.GetComponentInChildren<Text>().text; } int i = 1; bool bigger = false; foreach (var item in m_Cards) { if (card == item) { bigger = true; i = 6; } else { if (bigger) item.transform.SetSiblingIndex(i--); else item.transform.SetSiblingIndex(i++); item.GetComponent<RectTransform>().sizeDelta = new Vector2(m_CardWidth * 0.8f, m_CardHeight * 0.8f); } } }
public void OnBeginDrag(PointerEventData eventData) { newParent = this.transform.parent; oldParent = this.transform.parent; this.transform.SetParent (this.transform.parent.parent.parent.parent.parent); Debug.Log ("OLD PARENT IS: " + oldParent); GetComponent<CanvasGroup>().blocksRaycasts = false; UI_Container = GameObject.FindGameObjectWithTag ("UI Container"); //YAY GLOW if (oldParent.gameObject.transform.name.ToString () == "Scrollable List") { for (int i = 0; i < UI_Container.GetComponentInChildren<SquadSelectionScript>().MemberList.Length; i++) { Color glowColour = Color.Lerp (oldValue, newValue, Mathf.PingPong (Time.time, 8)); UI_Container.GetComponentInChildren<SquadSelectionScript>().MemberList[i].GetComponent<Image>().color = glowColour; } } //YAY WEAPONS GLOW if (oldParent.gameObject.transform.name.ToString () == "Scrollable Weapons List") { for (int i = 0; i < UI_Container.GetComponentInChildren<SquadSelectionScript>().WeaponList.Length; i++) { Color glowColour = Color.Lerp (oldValue, newValue, Mathf.PingPong (Time.time, 8)); UI_Container.GetComponentInChildren<SquadSelectionScript>().WeaponList[i].GetComponent<Image>().color = glowColour; } } }
public void DisplaySettingsFile(GameObject clickedButton) { // we need to clear out the children in the list before we generate new ones for (int i = 0; i < fieldsList.transform.childCount; i ++) { fieldsList.transform.GetChild(i).gameObject.SetActive(false); Debug.Log("destroying: " + fieldsList.transform.GetChild(i).name); Destroy(fieldsList.transform.GetChild(i).gameObject); } string file = settingsFileFolderPath + "/" + clickedButton.GetComponentInChildren<Text> ().text; string tmpFile = clickedButton.GetComponentInChildren<Text> ().text.Substring(0, clickedButton.GetComponentInChildren<Text> ().text.Length - 5); Type fileType = System.Type.GetType(tmpFile); activeSettingsFileType = fileType; WidgetSettings displayedFile = XmlIO.Load (file, fileType) as WidgetSettings; object[] displayedValues = displayedFile.GetValues (); FieldInfo[] fieldsArray = fileType.GetFields (); for (int i = 0; i < fieldsArray.Length; i++) { GameObject fieldUI = Instantiate (Resources.Load ("WidgetSettings/" + fieldsArray [i].FieldType.Name + "_UI")) as GameObject; fieldUI.transform.SetParent (fieldsList.transform); fieldUI.transform.FindChild("Title").GetComponent<Text>().text = fieldsArray[i].Name; fieldUI.GetComponent<FieldUIs>().SetFieldValue(displayedValues[i]); } }
/// <summary> /// In the Tiled layer add a custom property called 'physicsMaterial2D' to be used in the handler /// The value of the property must be a valid PhysicsMaterial2D located in the Assets/Materials/PhysicsMaterial/ /// </summary> public void HandleCustomProperties(GameObject gameObject, IDictionary<string, string> props) { //Se não existir o custom property já saimos if (!props.ContainsKey("physicsMaterial2D")) { return; } string materialName = props["physicsMaterial2D"] + ".physicsMaterial2D"; string materialPath = "Assets/Materials/PhysicsMaterial/" + materialName; // Verificamos se o material existe, se não existir disparamos o erro e retornamos PhysicsMaterial2D material = AssetDatabase.LoadAssetAtPath(materialPath, typeof(PhysicsMaterial2D)) as PhysicsMaterial2D; if (material == null) { Debug.LogError(String.Format("Could not find material: {0}", materialName)); return; } //O tiled2unity sempre exporta o collider como PolygonCollider, se mudar temos que refazer essa parte if (gameObject.GetComponentInChildren<PolygonCollider2D>() != null) { gameObject.GetComponentInChildren<PolygonCollider2D>().sharedMaterial = material; } }
void OnParticleCollision(GameObject other) { print("burn!!!!"); if (other.CompareTag("Torch")) { ParticleSystem fire = other.GetComponentInChildren<ParticleSystem>(); fire.Play(); } if (other.CompareTag("Rubble")) { Debug.Log("boom"); Rigidbody[] pieces = other.gameObject.GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody piece in pieces) { piece.isKinematic = false; piece.AddExplosionForce(500, other.gameObject.transform.position, 5); } BoxCollider goocollider = other.GetComponent<BoxCollider>(); goocollider.enabled = false; ParticleSystem bakahatsu = other.GetComponentInChildren<ParticleSystem>(); bakahatsu.Play(); GameObject goo = other.transform.FindChild("Goo").gameObject; Destroy(goo); } }
public void Swap(GameObject from, GameObject to) { Transform thisposition = from.transform; Vector2 temp_position = thisposition.position; GameObject temp_parent = thisposition.parent.gameObject; Transform targetposition = to.transform; from.transform.SetParent(targetposition.parent,false); from.transform.position = targetposition.position; to.transform.SetParent(temp_parent.transform,false); to.transform.position = temp_position; if(from.transform.parent.name.Contains("Substitution")){ from.GetComponentInChildren<PlayerDragScript>().enabled = false; } else{ from.GetComponentInChildren<PlayerDragScript>().enabled = true; } if(to.transform.parent.name.Contains("Substitution")){ to.GetComponentInChildren<PlayerDragScript>().enabled = false; } else{ to.GetComponentInChildren<PlayerDragScript>().enabled = true; } from.GetComponent<PlayerAttribute>().updateNameView(); to.GetComponent<PlayerAttribute>().updateNameView(); }
// Use this for initialization void Start() { if (GetComponent<Identity>().unitType.isBuilding()) { //GetComponent<Health>().setHealth(50); //GetComponent<Health>().setMaxHealth(50); //GetComponent<Health>().setAuxHealth(50); auxMaxHealth = GetComponent<BuildingConstruction>().timer; maxHealth = MapValues(auxMaxHealth, 0, auxMaxHealth, GetComponent<Health>().getMaxHealth() / 10, GetComponent<Health>().getMaxHealth()); curHealth = MapValues(auxMaxHealth - GetComponent<BuildingConstruction>().timer, 0, auxMaxHealth, GetComponent<Health>().getMaxHealth() / 10, GetComponent<Health>().getMaxHealth()); } else { maxHealth = GetComponent<Health>().getMaxHealth(); curHealth = GetComponent<Health>().getHealth(); } g = Instantiate(prefab); g.transform.SetParent(GameController.Instance.healthBarsParent.transform); g.transform.GetChild(0).transform.position = Camera.main.WorldToScreenPoint(GetComponentInChildren<auxHealth>().gameObject.transform.position); g1 = g.GetComponentInChildren<auxHealth>().gameObject; visualHealth = g.GetComponentInChildren<auxHealth>().i; unitLOSEntity = gameObject.GetComponent<LOSEntity>(); }
//Called by CreateNewUser public void ClickedUser(GameObject userObject) { //Changes userName in SaveLoad class to the text in the first Username slot saveLoad.userName = userObject.GetComponentInChildren<Text>().text; //Deletes and then saves the Users after deltetion saveLoad.Delete(); foreach(User user in createUser.listOfTypeUSERS) { if(userObject.GetComponentInChildren<Text>().text == user.getPlayerName()) { Debug.Log("Deleting "+userObject.GetComponentInChildren<Text>().text); index = createUser.listOfUsers.IndexOf(userObject); createUser.listOfUsers.Remove(userObject); createUser.listOfTypeUSERS.Remove(user); Destroy (userObject); if(createUser.usernameNumb != 0) createUser.usernameNumb--; else createUser.usernameNumb = 4; createUser.userNumbTracker--; break; } } DeletionOver(); }
private void SpawnMyPlayer() { myPlayer = PhotonNetwork.Instantiate("Character", Vector3.zero, Quaternion.identity, 0); myPlayer.GetComponentInChildren<PlayerMovement>().enabled = true; myPlayer.GetComponentInChildren<CameraScript>().enabled = true; myPlayer.GetComponentInChildren<Camera>().enabled = true; }
public void selectMonth(GameObject opcion){ btnMonth.GetComponentInChildren<Text> ().text = opcion.GetComponentInChildren<Text> ().text; Debug.Log (opcion.GetComponentInChildren<Text> ().text); GMS.userData.format_month (opcion.GetComponentInChildren<Text> ().text); DDMonth.SetActive (false); }
private void PopulateMap(GameObject mapObject) { int levelIndex = Random.Range(0, MainMenuManager.Levels.Count); MainMenuManager.LevelPackage level = MainMenuManager.Levels[levelIndex]; mapObject.GetComponentInChildren<Image>().sprite = level.Thumbnail; mapObject.GetComponentInChildren<Text>().text = level.Name; m_ShownMap.Add(new ExposedMap() { Name = level.Name, GameObject = mapObject }); }
void Start() { manaBar = GameObject.FindGameObjectWithTag("ManaBar"); spellBar = GameObject.FindGameObjectWithTag("SpellBar"); deathScreen = GameObject.FindGameObjectWithTag("DeathScreen"); generator = GameObject.FindGameObjectWithTag("Generator").GetComponent<GenerateScript>(); manaBar.GetComponentInChildren<Image>().fillMethod = Image.FillMethod.Radial360; manaBar.GetComponentInChildren<Image>().type = Image.Type.Filled; }
public CTTestInputDisplay(GameObject attchedGameObject) { gameObject = attchedGameObject; line = gameObject.GetComponentInChildren<LineRenderer>(); text = gameObject.GetComponentInChildren<GUIText>(); _trailVerts = new List<Vector3>(); GameMessenger.Reg("newTestInputRecording", this, Message_newTestInputRecording); GameMessenger.Reg("touch", this, Message_touch); }
public bool addNewMissile(GameObject missile, missileType mType) { switch (mType) { case(missileType.Homing): if (homingMissileObject != null) { return false; } homingMissileObject = missile; navPoint homingNav = homingMissileObject.GetComponentInChildren<navPoint> (); homingNav.playerColor = playerColor; homingNav.nameTag = nameTag; homingNav.refresh(); mC = homingMissileObject.GetComponentInChildren<homingMissileScript> (); mC.tLC = this; return true; case(missileType.Controlled): if (controlledMissileOjbect != null) { return false; } controlledMissileOjbect = missile; navPoint contNav = controlledMissileOjbect.GetComponentInChildren<navPoint> (); contNav.playerColor = playerColor; contNav.nameTag = nameTag; contNav.refresh (); contMisScript = missile.GetComponentInChildren<ControlledMissile> (); contMisScript.tLC = this; return true; case(missileType.Collector): Debug.Log("Received fire command"); if(ResourceMissile != null) { return false; } Debug.Log("Setting up AI missile"); ResourceMissile = missile; navPoint rescontNav = ResourceMissile.GetComponentInChildren<navPoint>(); rescontNav.playerColor = playerColor; rescontNav.nameTag = nameTag; rescontNav.refresh(); resourceMissileScript = missile.GetComponentInChildren<resourceRobot>(); resourceMissileScript.tLC = this; Debug.Log("Returning true"); return true; case(missileType.DefenseSystem): if(DefenseSystem != null){ return false; } DefenseSystem = missile; DefenseSystemScript = missile.GetComponentInChildren<defensesystem>(); DefenseSystemScript.tLC = this; return true; default: return false; } }
void Awake() { speech = transform.FindChild("SpeechBubble").gameObject; speechBubble = speech.GetComponentInChildren<tk2dSlicedSprite>(); textMesh = speech.GetComponentInChildren<tk2dTextMesh>(); speech.SetActive(false); UpdateTexts(text); }
private void OnSpiderHidden(GameObject spider) { if (spider.tag == "enemy") { Canvas canvas = spider.GetComponentInChildren<Canvas>(); if (canvas) spider.GetComponentInChildren<Canvas>().enabled = false; spider.GetComponent<EnemyScript>().anim.enabled = false; } }
public void ForceTouch(GameObject obj) { if (obj.GetComponent<Collider>()) { OnTriggerStay(obj.GetComponent<Collider>()); } else if (obj.GetComponentInChildren<Collider>()) { OnTriggerStay(obj.GetComponentInChildren<Collider>()); } }
public OneUnitHealthController(IUnitSettings unitSettings, Camera camera) { _unit = unitSettings.GraphicObject; _lookAtCameraController = _unit.GetComponentInChildren(typeof(LookAtCameraController)) as LookAtCameraController; _lookAtCameraController.main_camera = camera; _healthBarController = _unit.GetComponentInChildren(typeof(HealthBarController)) as HealthBarController; _healthBarController.Set(1.0f); _healthBarGameObject = _unit.transform.Find("healthbar").gameObject; }
private void OnSpiderVisible(GameObject spider) { if (spider.tag == "enemy" && hiss != null) { hiss.Stop(); hiss.Play(); Canvas canvas = spider.GetComponentInChildren<Canvas>(); if (canvas) spider.GetComponentInChildren<Canvas>().enabled = true; spider.GetComponent<EnemyScript>().anim.enabled = true; } }
void OnHexRedisplay(Tile tile_data, GameObject tile_current) { if (tile_data.Type == Tile.TileType.Empty) { tile_current.GetComponentInChildren<MeshRenderer> ().enabled = false; } else if (tile_data.Type == Tile.TileType.Terrian) { // Just do this right now as we only have 1 type of terrian. Later on we could add more types of terrian tiles, and // change the MeshRender depending on the type of terrian that is presented. tile_current.GetComponentInChildren<MeshRenderer> ().enabled = true; } else Debug.Log("There is an error in the tile type"); }
//FIXME_VAR_TYPE transform; //void Start() //{ // //GameObject lOwner = transform.parent.gameObject; // if (!owner) // return; // if (Network.peerType != NetworkPeerType.Disconnected && networkView.isMine) // { // networkView.RPC("RPCSetOwner", RPCMode.Others, owner.networkView.viewID); // networkView.enabled = true; // } //} public void setOwner(GameObject pOwner) { gameObject.name = "NS"; transform.parent = pOwner.transform; transform.localPosition = Vector3.zero; owner = pOwner; hero = owner.GetComponentInChildren<Hero>(); character = hero.getCharacter(); actionCommandControl = owner.GetComponentInChildren<ActionCommandControl>(); life = owner.GetComponent<Life>(); soldierModelSmoothMove = owner.GetComponent<SoldierModelSmoothMove>(); }
private void ToggleInteractableObject(GameObject interactable, bool toggle) { if (interactable.transform.parent.GetComponent<Chest>()) { interactable.transform.parent.GetComponent<Chest>().enabled = toggle; } if (interactable.GetComponent<InteractableObject>()) { interactable.GetComponent<InteractableObject>().enabled = toggle; } else if (interactable.GetComponentInChildren<InteractableObject>()) { interactable.GetComponentInChildren<InteractableObject>().enabled = toggle; } }
public void Spawn(int bonusId, Color color) { Vector3 position = new Vector3 ( Random.Range (-playbox.transform.localScale.x / 2, playbox.transform.localScale.x / 2), playbox.transform.localScale.y / 2 + transform.localScale.y * 2, 0); capsule = Instantiate (capsulePrefab, position, Quaternion.identity) as GameObject; capsule.GetComponentInChildren<MeshRenderer> ().material.color = color; capsule.GetComponentInChildren<CapsuleController> ().bonusId = bonusId; capsule.transform.GetChild (1).GetComponent<MeshRenderer> ().material.color = color; capsule.transform.parent = transform; }
public static T FindComponent <T>(this UnityEngine.GameObject g, bool in_parent = true, bool in_children = true, int sibling_depth = 0, bool ignore_self = false) where T : Component { if (ignore_self) { if (in_children) { foreach (Transform child in g.transform) { if (child.GetComponentInChildren <T>()) { return(child.GetComponentInChildren <T>()); } } } if (in_parent) { return(g.transform.parent.GetComponentInParent <T>()); } } if (g.GetComponent <T>() != null) { return(g.GetComponent <T>()); } if (in_children && g.GetComponentInChildren <T>() != null) { return(g.GetComponentInChildren <T>()); } if (in_parent) { if (g.GetComponentInParent <T>() != null) { return(g.GetComponentInParent <T>()); } } UnityEngine.GameObject current = g; while (sibling_depth > 0) { current = current.transform.parent.gameObject; if (!current) { break; } if (current.GetComponentInChildren <T>() != null) { return(current.GetComponentInChildren <T>()); } sibling_depth--; } return(g.GetComponent <T>()); }
void initHealthBar() { healthPanel = Instantiate(healthPrefab); healthPanel.transform.SetParent(canvas.transform, false); healthPanel.name = this.name; healthPanel.GetComponentInChildren<Text>().text = enemy.name; healthBar = healthPanel.GetComponentInChildren<Image>(); healthBar.name = this.name; damagePopup = healthPanel.gameObject.GetComponentsInChildren<Text>(true)[1]; }
void on_itemClick(UnityEngine.GameObject item) { Common.DEBUG_MSG("on_itemClick: " + item.name); UnityEngine.GameObject human_descr = UnityEngine.GameObject.Find("human_descr"); UnityEngine.GameObject skills_descr = UnityEngine.GameObject.Find("skills_descr"); if (item.name.IndexOf("skill") <= -1) { currsel_item = item.name; selectItemFocus(item); if (currsel_item == "item1_focus") { changeAvatarItem = 1; human_descr.GetComponentInChildren <UILabel>().text = "战士是真正的武器大师,攻击狂野而致命,每一击都体现了千锤百炼的高超剑技。 在战场上,战士们永远都在最前线,坚固的护甲以及不屈的意志,保护同伴,勇往直前,用血肉之躯杀出通往胜利的血路。"; skills_descr.GetComponentInChildren <UILabel>().text = "必杀技: 毁灭\r\n" + "使出全身的力量对敌人造成毁灭性的打击。"; } else if (currsel_item == "item2_focus") { changeAvatarItem = 2; human_descr.GetComponentInChildren <UILabel>().text = "法师是神秘与危险的化身,天地魔力的掌控者。法师使用魔法时天地色变、大地为之颤抖,大范围的魔法技能威力无与伦比。"; skills_descr.GetComponentInChildren <UILabel>().text = "必杀技: 死神降临\r\n" + "使出全身的力量对敌人造成毁灭性的打击。"; } else if (currsel_item == "item3_focus") { changeAvatarItem = 3; human_descr.GetComponentInChildren <UILabel>().text = "1法师是神秘与危险的化身,天地魔力的掌控者。法师使用魔法时天地色变、大地为之颤抖,大范围的魔法技能威力无与伦比。"; } else if (currsel_item == "item4_focus") { changeAvatarItem = 4; human_descr.GetComponentInChildren <UILabel>().text = "2法师是神秘与危险的化身,天地魔力的掌控者。法师使用魔法时天地色变、大地为之颤抖,大范围的魔法技能威力无与伦比。"; } else if (currsel_item == "item5_focus") { changeAvatarItem = 5; human_descr.GetComponentInChildren <UILabel>().text = "3法师是神秘与危险的化身,天地魔力的掌控者。法师使用魔法时天地色变、大地为之颤抖,大范围的魔法技能威力无与伦比。"; } else if (currsel_item == "item6_focus") { changeAvatarItem = 6; human_descr.GetComponentInChildren <UILabel>().text = "未开放这个职业。"; } resetSelAvatar(); } }
public void Content(GameObject btn) { string crdCode = btn.GetComponentInChildren<Text> ().text; if (crdCode[0] == 'C') { float r = returnToColor(crdCode.Substring(1,2)); float g = returnToColor(crdCode.Substring(3,2)); float b = returnToColor(crdCode.Substring(5,2)); if((int)btn.transform.localEulerAngles.y >= 90){ //Mostrar btn.GetComponent<Image>().color = new Color(r,g,b,1); btn.GetComponent<Image>().sprite = ctnImg; //Mostrar Color Carta no InputField input.GetComponent<Image>().color = new Color(r,g,b,1); } if((int)btn.transform.localEulerAngles.y >= 270){ //Nao Mostrar btn.GetComponent<Image>().color = new Color(1,1,1,1); btn.GetComponent<Image>().sprite = cardImg; //Nao Mostrar Color Carta no InputField input.GetComponent<Image>().color = new Color(0,0,0,1); } } else if (crdCode[0] == '#') { if((int)btn.transform.localEulerAngles.y >= 90){ //Mostrar btn.GetComponentInChildren<Text>().enabled = true; btn.GetComponent<Button>().enabled = false; btn.GetComponent<Image>().sprite = ctnImg; btn.GetComponent<Image>().color = new Color(0,0,0,1); //Mostrar Hex Carta no InputField input.GetComponentInChildren<Text>().text = crdCode; } if((int)btn.transform.localEulerAngles.y >= 270){ //Nao Mostrar btn.GetComponentInChildren<Text>().enabled = false; btn.GetComponent<Button>().enabled = true; btn.GetComponent<Image>().sprite = cardImg; btn.GetComponent<Image>().color = new Color(1,1,1,1); //Nao Mostrar Hex Carta no InputField input.GetComponentInChildren<Text>().text = ""; } } }
// Use this for initialization void Start () { // Instantiate tile for hover hoverTile = (GameObject) Instantiate(hoverTile); hoverTile.GetComponentInChildren<MeshRenderer>().enabled = false; // Create a mesh renderer component hoverTileRenderer = hoverTile.GetComponentInChildren<MeshRenderer>(); // Initialize other variables selectedRoomType = RoomType.None; selectedCell = new Vector2(-1,-1); rooms = new List<Room>(); }
//Includes ADS code. public void FireThisWeapon(Camera camera, GameObject currentWep) { if (Input.GetMouseButton(1) && !isReloading) { if (currentWep.GetComponent<GunMovement>().isFiring && currentWep.GetComponentInChildren<GunMechanics>().CurrentRate >= currentWep.GetComponentInChildren<GunMechanics>().RateOfFire && !isReloading) { currentWep.GetComponent<GunMovement>().Recoil(); currentWep.GetComponentInChildren<GunMechanics>().ShootBullet(); } else { if (!isReloading) { currentWep.GetComponent<GunMovement>().ADS(); } currentWep.GetComponentInChildren<GunMechanics>().CurrentRate += 1f * Time.deltaTime; currentWep.GetComponentInChildren<GunMechanics>().Muzzle.GetComponent<SpriteRenderer>().enabled = false; currentWep.GetComponentInChildren<GunMechanics>().AimDownSights(camera); } } else if (currentWep.GetComponent<GunMovement>().isFiring && currentWep.GetComponentInChildren<GunMechanics>().CurrentRate >= currentWep.GetComponentInChildren<GunMechanics>().RateOfFire && !isReloading) { currentWep.GetComponent<GunMovement>().Recoil(); currentWep.GetComponentInChildren<GunMechanics>().ShootBullet(); } else { currentWep.GetComponentInChildren<GunMechanics>().CurrentRate += 1f * Time.deltaTime; currentWep.GetComponentInChildren<GunMechanics>().Muzzle.GetComponent<SpriteRenderer>().enabled = false; currentWep.GetComponent<GunMovement>().Still(); currentWep.GetComponentInChildren<GunMechanics>().ReturnFromSights(camera); } }
public override void OnHit( GameObject other ) { if ( inmuneTimer > 0 ) return; if ( state == State.DYING ) return; hearts--; if ( other.GetComponentInChildren<Pottery>() != null ) hearts -= 2; hitFeedbackTimer = 0.2f; //inmuneTimer = 0.3f; Player p = other.GetComponentInChildren<Player>(); if ( p != null )//&& playerKnockbackHitFactor > 0 ) { p.velocity *= -playerKnockbackHitFactor; p.frictionCoef = 0.999f; velocity = p.direction * 0.03f; } if ( hearts <= 0 ) { gravity.y = -0.05f; Die(); state = State.DYING; animator.PlayAnim( "Death" ); collisionEnabled = false; } else { animator.renderer.material.SetColor ( "_AddColor", Color.black ); jumpAttacking = false; state = State.WALKING; } gravityEnabled = true; if ( SFXDeath.Length > 0 ) { AudioSource sfxdeath = SFXDeath[ Random.Range(0, SFXDeath.Length) ]; sfxdeath.pitch = Random.Range (0.9f, 1.1f); sfxdeath.Play(); } }
void Awake() { player = GameObject.FindGameObjectWithTag(Tags.player); if(player != null) { playerViewport = player.GetComponentInChildren<Camera>(); viewportBlur = player.GetComponentInChildren<Blur>(); playerInput = player.GetComponent<Player_Input>(); } contextMessage.text = ""; if (SceneManager.GetActiveScene().buildIndex == 2) levelController = GameObject.FindGameObjectWithTag(Tags.levelController).GetComponent<MainLevelController>(); }
static int GetComponentInChildren(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(System.Type))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); UnityEngine.Component o = obj.GetComponentInChildren(arg0); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(System.Type), typeof(bool))) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.ToObject(L, 1); System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); bool arg1 = LuaDLL.lua_toboolean(L, 3); UnityEngine.Component o = obj.GetComponentInChildren(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentInChildren")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void on_selListItem3Click(UnityEngine.GameObject item) { currsel_selListItem = item.name; changeAvatarItem = 0; if (avatarList.Count > 0) { AvatarInfo info = avatarList[2]; changeAvatarItem = info.roleType; Monitor.Enter(KBEngineApp.app.entities); Account account = (Account)KBEngineApp.app.player(); Monitor.Enter(account.avatars); if ((UInt64)account.lastSelCharacter == 0) { account.lastSelCharacter = info.dbid; } Monitor.Exit(KBEngineApp.app.entities); } selectSelListItemFocus(item); UnityEngine.GameObject human_descr = UnityEngine.GameObject.Find("human_descr"); UnityEngine.GameObject skills_descr = UnityEngine.GameObject.Find("skills_descr"); human_descr.GetComponentInChildren <UILabel>().text = "角色目前很强壮哦, 去竞技场和人pk刷排名吧。"; skills_descr.GetComponentInChildren <UILabel>().text = "您的打击能力已经非常高了, 可以尝试提升防御等其他能力。"; resetSelAvatar(); }
static public int GetComponentInChildren(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponentInChildren(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); var ret = self.GetComponentInChildren(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static int QPYX_GetComponentInChildren_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2) { UnityEngine.GameObject QPYX_obj_YXQP = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); System.Type QPYX_arg0_YXQP = ToLua.CheckMonoType(L_YXQP, 2); UnityEngine.Component QPYX_o_YXQP = QPYX_obj_YXQP.GetComponentInChildren(QPYX_arg0_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } else if (QPYX_count_YXQP == 3) { UnityEngine.GameObject QPYX_obj_YXQP = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.GameObject)); System.Type QPYX_arg0_YXQP = ToLua.CheckMonoType(L_YXQP, 2); bool QPYX_arg1_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 3); UnityEngine.Component QPYX_o_YXQP = QPYX_obj_YXQP.GetComponentInChildren(QPYX_arg0_YXQP, QPYX_arg1_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.GameObject.GetComponentInChildren")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int GetComponentInChildren(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject <UnityEngine.GameObject>(L, 1); System.Type arg0 = ToLua.CheckMonoType(L, 2); UnityEngine.Component o = obj.GetComponentInChildren(arg0); ToLua.Push(L, o); return(1); } else if (count == 3) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject <UnityEngine.GameObject>(L, 1); System.Type arg0 = ToLua.CheckMonoType(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); UnityEngine.Component o = obj.GetComponentInChildren(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentInChildren")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void on_selListItem1Click(UnityEngine.GameObject item) { if (item == null) { return; } currsel_selListItem = item.name; changeAvatarItem = 0; if (avatarList.Count > 0) { AvatarInfo info = avatarList[0]; changeAvatarItem = info.roleType; } selectSelListItemFocus(item); UnityEngine.GameObject human_descr = UnityEngine.GameObject.Find("human_descr"); UnityEngine.GameObject skills_descr = UnityEngine.GameObject.Find("skills_descr"); human_descr.GetComponentInChildren <UILabel>().text = "角色目前还很脆弱哦, 您当前可以找XXX去做任务获得经验。"; skills_descr.GetComponentInChildren <UILabel>().text = "您可以去兽人洞穴击杀boss获得xx技能书来提升打击能力。"; resetSelAvatar(); }
private bool AddGrabPoints(GameObject obj) { if (!obj) { return(false); } var points = obj.GetComponentInChildren <HVRGrabPoints>()?.gameObject; if (points) { if (!EditorUtility.DisplayDialog("Warning!", "GrabPoint component exists in children, add another?", "Yes", "No")) { Debug.Log($"This object already has a child VRGrabPoints"); grabPointsObjectField.value = points; return(false); } } points = new GameObject("GrabPoints"); var vrGrabPoints = points.AddComponent <HVRGrabPoints>(); points.transform.parent = obj.transform; points.transform.ResetLocalProps(); //vrGrabPoints.AddRunTimePoses(); //AddGrabPoint(points); grabPointsObjectField.value = points; obj.SetExpandedRecursive(true); return(true); }
private void getAnimator() { GO self = this.gameObject; if (this.unityAnimator == null) { this.unityAnimator = self.GetComponentInChildren <Animator>(); } }
public void button_buyUpgrade(UnityEngine.GameObject sender) { bool isBuy = false; string typeOfBuy = sender.name[0].ToString(); int upgNum = Convert.ToInt16((sender.name[1].ToString() + sender.name[2].ToString())); if (typeOfBuy == "l") { if (upgNum == 1) { isBuy = up[upgNum - 1].buyUpgr(Convert.ToUInt64(_game.litresSt)); } if (upgNum > 1 && up[upgNum - 2]._count >= 1) { isBuy = up[upgNum - 1].buyUpgr(Convert.ToUInt64(_game.litresSt)); } } if (typeOfBuy == "d") { isBuy = donUp[upgNum - 1].buyUpgr(_game.donvalSt); if (isBuy) { switch (upgNum) { case 2: if (donUp[upgNum - 1]._count == 1) { _friend.SetActive(!_friend.activeSelf); _friend_legs.SetActive(!_friend_legs.activeSelf); } break; case 3: if (donUp[upgNum - 1]._count == 1) { _waiter.SetActive(!_waiter.activeSelf); } break; default: break; } } } if (isBuy) { setUpgName(); } else { sender.GetComponentInChildren <Text>().text = langT[lng + "_nomoney"].ToString(); StartCoroutine(no_money_my_friend(sender)); } isBuy = false; }
public static T GetLocalComponent <T>(UGameObject gameObject) where T : Component { T component = gameObject.GetComponent <T>(); if (component) { return(component); } return(gameObject.GetComponentInChildren <T>()); }
void Update() { launchButton.SetActive(isValidParticipant(participantNameInput.text)); greyedLaunchButton.SetActive(!launchButton.activeSelf); if (isValidParticipant(participantNameInput.text)) { int sessionNumber = UpdatedParticipantSelection.nextSessionNumber; launchButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Start session " + sessionNumber.ToString(); } }
/// <summary>Gets the component, including checking children if specified</summary> /// <typeparam name="TComponent">Component type</typeparam> /// <param name="this">The UnityEngine GameObject</param> /// <param name="includeChildren">Whether to check children if the component is not found on the GameObject</param> /// <returns>The component, if found; otherwise, null.</returns> public static TComponent GetComponent <TComponent>(this UnityEngine.GameObject @this, bool includeChildren) where TComponent : UnityEngine.Component { var component = @this.GetComponent <TComponent>(); if (component == null) { component = @this.GetComponentInChildren <TComponent>(); } return(component); }
//------------------------------------------------- public GameObject SpawnBalloon(Balloon.BalloonColor color = Balloon.BalloonColor.Red) { if (balloonPrefab == null) { return(null); } UnityEngine.GameObject balloon = Instantiate(balloonPrefab, transform.position, transform.rotation) as UnityEngine.GameObject; balloon.transform.localScale = new Vector3(scale, scale, scale); if (attachBalloon) { balloon.transform.parent = transform; } if (sendSpawnMessageToParent) { if (transform.parent != null) { transform.parent.SendMessage("OnBalloonSpawned", balloon, SendMessageOptions.DontRequireReceiver); } } if (playSounds) { if (inflateSound != null) { inflateSound.Play(); } if (stretchSound != null) { stretchSound.Play(); } } balloon.GetComponentInChildren <Balloon>().SetColor(color); if (spawnDirectionTransform != null) { balloon.GetComponentInChildren <Rigidbody>().AddForce(spawnDirectionTransform.forward * spawnForce); } return(balloon); }
static public int GetComponentInChildren(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponentInChildren(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); var ret = self.GetComponentInChildren(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function GetComponentInChildren to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public static GameObject FindSelectionBase(GameObject go) { if (go == null) { return(null); } #if UNITY_2018_3_OR_NEWER Transform prefabBase = null; if (UnityEditor.PrefabUtility.IsPartOfNonAssetPrefabInstance(go)) { prefabBase = UnityEditor.PrefabUtility.GetOutermostPrefabInstanceRoot(go).transform; } #endif GameObject group = null; Transform groupTransform = null; var node = go.GetComponentInChildren <ChiselNode>(); if (node) { var composite = GetGroupCompositeForNode(node); group = (composite == null) ? null : composite.gameObject; groupTransform = (composite == null) ? null : composite.transform; } Transform tr = go.transform; while (tr != null) { #if UNITY_2018_3_OR_NEWER if (tr == prefabBase) { return(tr.gameObject); } #endif if (tr == groupTransform) { return(group); } if (GameObjectContainsAttribute <SelectionBaseAttribute>(tr.gameObject)) { return(tr.gameObject); } tr = tr.parent; } return(go); }
static public int GetComponentInChildren(IntPtr l) { try { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponentInChildren(a1); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int GetComponentInChildren(IntPtr l) { try { UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponentInChildren(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int GetComponentInChildren(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); System.Type arg0 = (System.Type)ToLua.CheckObject(L, 2, typeof(System.Type)); UnityEngine.Component o = obj.GetComponentInChildren(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static int GetComponentInChildren1_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.GameObject obj = get_obj(nThisPtr); System.Type arg0 = FCGetObj.GetObj <System.Type>(FCLibHelper.fc_get_wrap_objptr(L, 0)); UnityEngine.Component ret = obj.GetComponentInChildren(arg0); long ret_ptr = FCLibHelper.fc_get_return_ptr(L); long v = FCGetObj.PushObj(ret); FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, v); } catch (Exception e) { Debug.LogException(e); } return(0); }
public void HandleCustomProperties(UnityEngine.GameObject gameObject, IDictionary <string, string> props) { // Simply add a component to our GameObject if (props.ContainsKey("opacity")) { try { string prop = props["opacity"]; float opacity = float.Parse(prop); Tiled2Unity.TiledInitialShaderProperties properties = gameObject.GetComponentInChildren <Tiled2Unity.TiledInitialShaderProperties>(); properties.InitialOpacity = opacity; } catch (Exception e) { Debug.LogError(e.Message); } } }
static public void WaitInput(GO caller, int column, Actions action) { if (waitFunc != null || waitCaller != null) { return; } axis[] arr = getArr(column); KeyLogger kl = caller.GetComponentInChildren <KeyLogger>(); if (kl == null) { kl = caller.AddComponent <KeyLogger>(); } kl.enabled = true; waitCaller = kl; waitFunc = kl.StartCoroutine(_waitInput(arr, action)); }
void on_selListItem2Click(UnityEngine.GameObject item) { currsel_selListItem = item.name; changeAvatarItem = 0; if (avatarList.Count > 0) { AvatarInfo info = avatarList[1]; changeAvatarItem = info.roleType; } selectSelListItemFocus(item); UnityEngine.GameObject human_descr = UnityEngine.GameObject.Find("human_descr"); UnityEngine.GameObject skills_descr = UnityEngine.GameObject.Find("skills_descr"); human_descr.GetComponentInChildren <UILabel>().text = "已不再是新手了, 可以去xx领地刷boss。"; skills_descr.GetComponentInChildren <UILabel>().text = "您可以去兽人洞穴击杀boss获得xx技能书来提升打击能力。"; resetSelAvatar(); }
static int GetComponentInChildren(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.GameObject.Register"); #endif try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); System.Type arg0 = ToLua.CheckMonoType(L, 2); UnityEngine.Component o = obj.GetComponentInChildren(arg0); ToLua.Push(L, o); return(1); } else if (count == 3) { UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); System.Type arg0 = ToLua.CheckMonoType(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); UnityEngine.Component o = obj.GetComponentInChildren(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentInChildren")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void OpenUi() { if (string.IsNullOrEmpty(delayBtnName)) { return; } UnityEngine.GameObject window = UIManager.Instance.GetWindowGoByName("MainCityUI"); if (window != null) { MainCityTopTween script = window.GetComponentInChildren <MainCityTopTween>(); if (script != null) { script.Down(); } } switch (delayBtnName) { case "Entrance-Equipment": OpenAndCloseWindow("GamePokey"); break; case "Entrance-Skill": OpenAndCloseWindow("SkillPanel"); break; case "Entrance-GodEquip": OpenAndCloseWindow("ArtifactPanel"); break; case "Entrance-Mission": OpenAndCloseWindow("GameTask"); JoyStickInputProvider.JoyStickEnable = false; ArkCrossEngine.GfxSystem.EventChannelForLogic.Publish("ge_reload_missions", "lobby"); break; //case "Entrance-Match": /*EnterInScene(2);*/ // //OpenAndCloseWindow("PvPEntrance"); // LogicSystem.SendStoryMessage("cityplayermove", 2); // break; case "Entrance-Treasure": RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (role_info != null && role_info.Level < ExpeditionPlayerInfo.c_UnlockLevel) { string chn_desc = StrDictionaryProvider.Instance.GetDictString(456); string chn_confirm = StrDictionaryProvider.Instance.GetDictString(4); ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", chn_desc, chn_confirm, null, null, null, false); } else { OpenAndCloseWindow("cangbaotu"); } break; case "Entrance-Mail": //OpenAndCloseWindow("Mail"); break; case "Entrance-Friend": LogicSystem.PublishLogicEvent("ge_request_friends", "lobby"); OpenAndCloseWindow("Friend"); break; case "Entrance-XHun": OpenAndCloseWindow("XHun"); break; case "Entrance-Partner": OpenAndCloseWindow("Partner"); break; //case "Entrance-Trial": // LogicSystem.SendStoryMessage("cityplayermove", 1); // break; case "Entrance-Shop": OpenAndCloseWindow("Store"); break; case "Entrance-Award": //OpenAndCloseWindow("ActivityAward"); break; case "Entrance-Settings": break; } }
public void OnButtonClick(UnityEngine.GameObject go) { if (go == null) { return; } delayBtnName = ""; switch (go.name) { //case "Entrance-Equipment": // OpenAndCloseWindow("GamePokey"); // break; //case "Entrance-Skill": // OpenAndCloseWindow("SkillPanel"); // break; //case "Entrance-GodEquip": // OpenAndCloseWindow("ArtifactPanel"); // break; //case "Entrance-Mission": // OpenAndCloseWindow("GameTask"); // JoyStickInputProvider.JoyStickEnable = false; // ArkCrossEngine.GfxSystem.EventChannelForLogic.Publish("ge_reload_missions", "lobby"); // if (WorldSystem.Instance.IsPureClientScene()) { // CYGTConnector.HideCYGTSDK(); // } // break; case "Entrance-Match": /*EnterInScene(2);*/ //OpenAndCloseWindow("PvPEntrance"); LogicSystem.SendStoryMessage("cityplayermove", 2); break; //case "Entrance-Treasure": // RoleInfo role_info = LobbyClient.Instance.CurrentRole; // if (role_info != null && role_info.Level < ExpeditionPlayerInfo.c_UnlockLevel) { // string chn_desc = StrDictionaryProvider.Instance.GetDictString(456); // string chn_confirm = StrDictionaryProvider.Instance.GetDictString(4); // ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", chn_desc, chn_confirm, null, null, null, false); // } else { // OpenAndCloseWindow("cangbaotu"); // } // break; //case "Entrance-Mail": // OpenAndCloseWindow("Mail"); // break; //case "Entrance-Friend": // LogicSystem.PublishLogicEvent("ge_request_friends", "lobby"); // OpenAndCloseWindow("Friend"); // break; //case "Entrance-XHun": // OpenAndCloseWindow("XHun"); // break; //case "Entrance-Partner": // OpenAndCloseWindow("Partner"); // break; case "Entrance-Trial": //LogicSystem.SendStoryMessage("cityplayermove", 1); break; //case "Entrance-Shop": // OpenAndCloseWindow("Store"); // break; //case "Entrance-Award": // OpenAndCloseWindow("ActivityAward"); // break; default: delayBtnName = go.name; UnityEngine.GameObject window = UIManager.Instance.GetWindowGoByName("MainCityUI"); if (window != null) { MainCityTopTween script = window.GetComponentInChildren <MainCityTopTween>(); if (script != null) { script.Up(); Invoke("OpenUi", 0.3f); } else { OpenUi(); } } break; } }
public static Component GetComponentInChildren1T(this UnityEngine.GameObject self, System.Boolean includeInactive, System.Type T) { return(self.GetComponentInChildren(T, includeInactive)); }
void autoSetPosition() { if (windowsize == Screen.width + Screen.height) { return; } UnityEngine.GameObject go = UnityEngine.GameObject.Find("avatars_panel"); windowsize = Screen.width + Screen.height; Vector3 pos = go.transform.localPosition; float x = (-((float)(Screen.width / 2))) + ((float)go.GetComponent <UITexture>().width / 2) + 0.5f; float y = 0.0f; pos.x = x; pos.y = y; go.transform.localPosition = pos; Common.DEBUG_MSG("screen-size: x=" + Screen.width + "y=" + Screen.height); Common.DEBUG_MSG("avatar-panel-tu: x=" + go.GetComponent <UITexture>().width + "y=" + go.GetComponent <UITexture>().height); Common.DEBUG_MSG("avatar-panel: x=" + x + "y=" + y); UnityEngine.GameObject fuse_left = UnityEngine.GameObject.Find("fuse_left"); UnityEngine.GameObject fuse_right = UnityEngine.GameObject.Find("fuse_right"); UnityEngine.GameObject lianxing_left = UnityEngine.GameObject.Find("lianxing_left"); UnityEngine.GameObject lianxing_right = UnityEngine.GameObject.Find("lianxing_right"); UnityEngine.GameObject faxing_left = UnityEngine.GameObject.Find("faxing_left"); UnityEngine.GameObject faxing_right = UnityEngine.GameObject.Find("faxing_right"); UnityEngine.GameObject wenshen_left = UnityEngine.GameObject.Find("wenshen_left"); UnityEngine.GameObject wenshen_right = UnityEngine.GameObject.Find("wenshen_right"); UnityEngine.GameObject avataritem1 = UnityEngine.GameObject.Find("item1"); UnityEngine.GameObject avataritem2 = UnityEngine.GameObject.Find("item2"); UnityEngine.GameObject avataritem3 = UnityEngine.GameObject.Find("item3"); UnityEngine.GameObject avataritem4 = UnityEngine.GameObject.Find("item4"); UnityEngine.GameObject avataritem5 = UnityEngine.GameObject.Find("item5"); UnityEngine.GameObject avataritem6 = UnityEngine.GameObject.Find("item6"); UnityEngine.GameObject avataritem1_focus_trigger = UnityEngine.GameObject.Find("item1_focus"); UnityEngine.GameObject avataritem2_focus_trigger = UnityEngine.GameObject.Find("item2_focus"); UnityEngine.GameObject avataritem3_focus_trigger = UnityEngine.GameObject.Find("item3_focus"); UnityEngine.GameObject avataritem4_focus_trigger = UnityEngine.GameObject.Find("item4_focus"); UnityEngine.GameObject avataritem5_focus_trigger = UnityEngine.GameObject.Find("item5_focus"); UnityEngine.GameObject avataritem6_focus_trigger = UnityEngine.GameObject.Find("item6_focus"); UnityEngine.GameObject skillitem1 = UnityEngine.GameObject.Find("skill_item1"); UnityEngine.GameObject skillitem2 = UnityEngine.GameObject.Find("skill_item2"); UnityEngine.GameObject skillitem3 = UnityEngine.GameObject.Find("skill_item3"); UnityEngine.GameObject skillitem1_focus_trigger = UnityEngine.GameObject.Find("skill_item1_focus"); UnityEngine.GameObject skillitem2_focus_trigger = UnityEngine.GameObject.Find("skill_item2_focus"); UnityEngine.GameObject skillitem3_focus_trigger = UnityEngine.GameObject.Find("skill_item3_focus"); UnityEngine.GameObject avatarlist_label = UnityEngine.GameObject.Find("avatarlist_label"); UnityEngine.GameObject skilllist_label = UnityEngine.GameObject.Find("skilllist_label"); UnityEngine.GameObject create_username = UnityEngine.GameObject.Find("create_username"); UnityEngine.GameObject createAvatarButton = UnityEngine.GameObject.Find("createAvatarButton"); UnityEngine.GameObject removeAvatarButton = UnityEngine.GameObject.Find("removeAvatarButton"); UnityEngine.GameObject removeAvatarInputName = UnityEngine.GameObject.Find("removeAvatarInputName"); UnityEngine.GameObject backbtn = UnityEngine.GameObject.Find("back"); UnityEngine.GameObject entergame = UnityEngine.GameObject.Find("entergame"); UnityEngine.GameObject goto_createavatarmode = UnityEngine.GameObject.Find("goto_createavatarmode"); UnityEngine.GameObject sel_list_item_panel1 = UnityEngine.GameObject.Find("sel_list_item_panel1"); UnityEngine.GameObject sel_list_item_panel2 = UnityEngine.GameObject.Find("sel_list_item_panel2"); UnityEngine.GameObject sel_list_item_panel3 = UnityEngine.GameObject.Find("sel_list_item_panel3"); UnityEngine.GameObject human_descr = UnityEngine.GameObject.Find("human_descr"); UnityEngine.GameObject skills_descr = UnityEngine.GameObject.Find("skills_descr"); hideItemFocus(); hideSelListItemFocus(); int width = avataritem1.GetComponent <UITexture>().mainTexture.width; int height = avataritem1.GetComponent <UITexture>().mainTexture.height; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 0.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) + 10.0f; avatarlist_label.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 0.0f; pos.y -= 15.0f; skilllist_label.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 35.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 35.0f; avataritem1.transform.localPosition = pos; pos.z = -2.0f; avataritem1_focus_trigger.transform.localPosition = pos; pos = avataritem1.transform.localPosition; pos.y -= height; pos.z = -1.0f; avataritem2.transform.localPosition = pos; pos.z = -2.0f; avataritem2_focus_trigger.transform.localPosition = pos; pos = avataritem2.transform.localPosition; pos.y -= height; pos.z = -1.0f; avataritem3.transform.localPosition = pos; pos.z = -2.0f; avataritem3_focus_trigger.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x += 35.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 35.0f; avataritem4.transform.localPosition = pos; pos.z = -2.0f; avataritem4_focus_trigger.transform.localPosition = pos; pos = avataritem4.transform.localPosition; pos.y -= height; pos.z = -1.0f; avataritem5.transform.localPosition = pos; pos.z = -2.0f; avataritem5_focus_trigger.transform.localPosition = pos; pos = avataritem5.transform.localPosition; pos.y -= height; pos.z = -1.0f; avataritem6.transform.localPosition = pos; pos.z = -2.0f; avataritem6_focus_trigger.transform.localPosition = pos; //----------------------------------------------------------- pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 60.0f; pos.y -= 55.0f; skillitem1.transform.localPosition = pos; pos.z = -2.0f; skillitem1_focus_trigger.transform.localPosition = pos; pos = skillitem1.transform.localPosition; pos.x += 60; pos.z = -1.0f; skillitem2.transform.localPosition = pos; pos.z = -2.0f; skillitem2_focus_trigger.transform.localPosition = pos; pos = skillitem2.transform.localPosition; pos.x += 60; pos.z = -1.0f; skillitem3.transform.localPosition = pos; pos.z = -2.0f; skillitem3_focus_trigger.transform.localPosition = pos; //----------------------------------------------------------- selectItemFocus(UnityEngine.GameObject.Find(currsel_item)); selectSelListItemFocus(UnityEngine.GameObject.Find(currsel_selListItem)); //----------------------------------------------------------- pos = create_username.transform.localPosition; pos.y = -(Screen.height / 2 - 50.0f); create_username.transform.localPosition = pos; pos = createAvatarButton.transform.localPosition; pos.y = -(Screen.height / 2 - 15.0f); createAvatarButton.transform.localPosition = pos; pos = entergame.transform.localPosition; pos.y = -(Screen.height / 2 - 15.0f); entergame.transform.localPosition = pos; pos = removeAvatarInputName.transform.localPosition; pos.x = -((Screen.width / 2) * 0.15f); pos.y = 0.0f; removeAvatarInputName.transform.localPosition = pos; pos = backbtn.transform.localPosition; pos.x = (Screen.width / 2 - 100.0f); pos.y = -(Screen.height / 2 - 15.0f); backbtn.transform.localPosition = pos; pos = removeAvatarButton.transform.localPosition; pos.x = (Screen.width / 2 - 100.0f); pos.y = -(Screen.height / 2 - 45.0f); removeAvatarButton.transform.localPosition = pos; pos = goto_createavatarmode.transform.localPosition; pos.x = (Screen.width / 2 - 100.0f); pos.y = -(Screen.height / 2 - 75.0f); goto_createavatarmode.transform.localPosition = pos; //----------------------------------------------------------- pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 60.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 10.0f; sel_list_item_panel1.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 60.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 80.0f; sel_list_item_panel2.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x -= 60.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 150.0f; sel_list_item_panel3.transform.localPosition = pos; //------------------------------------------------------------- pos.x = x; pos.y = y; pos.z = -1.0f; pos.x += 20.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 300.0f; fuse_left.transform.localPosition = pos; pos.x += 30.0f; fuse_right.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x += 20.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 328.0f; lianxing_left.transform.localPosition = pos; pos.x += 30.0f; lianxing_right.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x += 20.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 355.0f; faxing_left.transform.localPosition = pos; pos.x += 30.0f; faxing_right.transform.localPosition = pos; pos.x = x; pos.y = y; pos.z = -1.0f; pos.x += 20.0f; pos.y += (((float)go.GetComponent <UITexture>().height / 2) - height) - 382.0f; wenshen_left.transform.localPosition = pos; pos.x += 30.0f; wenshen_right.transform.localPosition = pos; hideModeUI(); //----------------------------------------------------------- pos = human_descr.transform.localPosition; x = ((float)(Screen.width / 2)) - human_descr.GetComponentInChildren <UITexture>().width / 2 - 0.5f; y = 0.0f; pos.x = x; pos.y = ((float)(Screen.height / 2)) - (skills_descr.GetComponentInChildren <UITexture>().height / 2) - 0.5f; human_descr.transform.localPosition = pos; pos = skills_descr.transform.localPosition; x = ((float)(Screen.width / 2)) - skills_descr.GetComponentInChildren <UITexture>().width / 2 - 0.5f; y = 0.0f; pos.x = x; pos.y = -100.0f; skills_descr.transform.localPosition = pos; }