Пример #1
0
 void hide(GameObject bt)
 {
     messageBox.gameObject.SetActive(false);
     blurPanel.gameObject.SetActive(false);
     info.show = false;
     isShow = false;
 }
Пример #2
0
        public void Create(GameObject item, List<LoadItemInfo> list, float size)
        {
            foreach (var t in list)
            {
                var go = Instantiate(item);
                var rect = go.GetComponent<RectTransform>();
                rect.SetParent(gameObject.transform);
                rect.anchoredPosition3D = new Vector3(0, 0, 0);
                rect.localScale = new Vector3(1.0f, 1.0f, 1.0f);

                var scrollItem = go.GetComponent<ScrollItem>();

                scrollItem.Logo.sprite = t.Logo;
                scrollItem.Index.text = t.Index.ToString();
                scrollItem.Name.text = t.Type.ToString();
                scrollItem.Type = t.Type;

                Items.Add(scrollItem);
            }

            Size = 160;
            Shift = 0;

            var s = gameObject.GetComponent<RectTransform>().sizeDelta;
            s.y = size*list.Count;
            gameObject.GetComponent<RectTransform>().sizeDelta = s;
        }
        // We have many independent requests on the ImportBehaviour so we can't take for granted it has been created yet.
        // However, if it has been created then use it.
        public static ImportBehaviour FindOrCreateImportBehaviour(string xmlPath)
        {
            string importName = Path.GetFileNameWithoutExtension(xmlPath);

            // Try to find
            foreach (var status in UnityEngine.Object.FindObjectsOfType<ImportBehaviour>())
            {
                if (String.Compare(status.ImportName, importName, true) == 0)
                {
                    return status;
                }
            }

            // Couldn't find, so create.
            Debug.LogFormat("Tiled2Unity import status create for file {0}", xmlPath);
            GameObject gameObject = new GameObject("__temp_tiled2unity_import");
            gameObject.transform.SetAsFirstSibling();

            var importStatus = gameObject.AddComponent<ImportBehaviour>();
            importStatus.ImportName = Path.GetFileNameWithoutExtension(xmlPath);

            // Opening the XDocument itself can be expensive so start the progress bar just before we start
            importStatus.StartProgressBar(xmlPath);
            importStatus.XmlDocument = XDocument.Load(xmlPath);

            importStatus.numberOfElements = importStatus.XmlDocument.Element("Tiled2Unity").Elements().Count();
            importStatus.IncrementProgressBar(xmlPath);

            return importStatus;
        }
Пример #4
0
 private void DoGetFsmVector2()
 {
     if (this.storeValue == null)
     {
         return;
     }
     GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);
     if (ownerDefaultTarget == null)
     {
         return;
     }
     if (ownerDefaultTarget != this.goLastFrame)
     {
         this.goLastFrame = ownerDefaultTarget;
         this.fsm = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, this.fsmName.Value);
     }
     if (this.fsm == null)
     {
         return;
     }
     FsmVector2 fsmVector = this.fsm.FsmVariables.GetFsmVector2(this.variableName.Value);
     if (fsmVector == null)
     {
         return;
     }
     this.storeValue.Value = fsmVector.Value;
 }
        public override void UpdateTime(GameObject Actor, float runningTime, float deltaTime)
        {
            Animation animation = Actor.GetComponent<Animation>();

            if (!animation || animationClip == null)
            {
                return;
            }

            if (animation[animationClip.name] == null)
            {
                animation.AddClip(animationClip, animationClip.name);
            }

            AnimationState state = animation[animationClip.name];

            if (!animation.IsPlaying(animationClip.name))
            {
                animation.wrapMode = wrapMode;
                animation.Play(animationClip.name);
            }

            state.time = runningTime;
            state.enabled = true;
            animation.Sample();
            state.enabled = false;
        }
Пример #6
0
 public ISWeapon(int durability, int maxDurability, ISEquipmentSlot equipmentSlot, GameObject prefab)
 {
     _durability = durability;
     _maxDurability = maxDurability;
     _equipmentSlot = equipmentSlot;
     _prefab = prefab;
 }
		//assign edilen objeler statik olmali
		public override void loadResources()
		{
			staticTowerObject = (GameObject)Resources.Load("3Ds/Towers/Physics/BallistaTower/TowerObject");            
			staticTowerIcon = (Texture2D)Resources.Load("3Ds/Towers/Physics/BallistaTower/GUI/towerIcon");
            staticCreateSound = (AudioClip)Resources.Load("Sound/tower_build");
			staticRangeProjector = ((GameObject)Resources.Load ("3Ds/Scenes/Game/RangeProjector")).GetComponent<Projector>();
		}
        public void SubmitLap(GameObject car, int team)
        {
            switch (team)
            {
                case 1:
                    if (m_LapTimeTeamOne >= 60.0f)
                    {
                        m_LapsTeamOne += 1;
                        m_LapTimeTeamOne = 0.0f;
                    }
                    break;

                case 2:
                    if (m_LapTimeTeamTwo >= 60.0f)
                    {
                        m_LapsTeamTwo += 1;
                        m_LapTimeTeamTwo = 0.0f;
                    }
                    break;
            }

            if (m_LapsTeamOne >= 2)
            {
                instance.SubmitGameResults(m_TeamOneWon);
            }
            if (m_LapsTeamTwo >= 2)
            {
                instance.SubmitGameResults(m_TeamTwoWon);
            }
        }
Пример #9
0
				//private PlayerScript controller;
		
				public PlayState2 (StateManager managerRef)
				{ //Constructor
						manager = managerRef;
						Debug.Log ("Constructing PlayState2");
						manager.darkState = false; 
			
						"Stage2".LoadScene ();
						//if (Application.loadedLevelName != "Stage2")
						//		Application.LoadLevel ("Stage2");
			
						StaticMethods.SetOneActive ("Following Camera", manager.gameDataRef.cameras); //Camera that follows the Player, setOneActive method

						player = GameObject.FindGameObjectWithTag ("Player"); //the Player GameObject is now active and can be found
						player.GetComponent<Rigidbody2D> ().isKinematic = false; //Player is now affected by physics
			
						player.transform.SetPositionXY (-6.0f, -0.4f); //set starting position for Player
						skin = Resources.Load ("GUISkin") as GUISkin;
				
						//darkness = GameObject.FindGameObjectWithTag ("Darkness");
						//dark.a += 0f;
						//darkness.GetComponent<Renderer>().material.color = dark; 
			
						//darkness.GetComponent<Renderer>().material.color.a;
						//Color dark = darkness.renderer.material.color;
						//dark.a -= 0;
						//darkness.renderer.material.color = color;
				}
 public static void CreatePattern(MenuCommand menuCommand)
 {
     var pattern = new GameObject("Pattern", typeof(Pattern));
     GameObjectUtility.SetParentAndAlign(pattern, menuCommand.context as GameObject);
     Undo.RegisterCreatedObjectUndo(pattern, "Create " + pattern.name);
     Selection.activeGameObject = pattern;
 }
Пример #11
0
        void DoSmoothLookAt()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null)
            {
                return;
            }

            var goTarget = targetObject.Value;
            if (goTarget == null && targetPosition.IsNone)
            {
                return;
            }

            // re-initialize if game object has changed

            if (previousGo != go)
            {
                lastRotation = go.transform.rotation;
                desiredRotation = lastRotation;
                previousGo = go;
            }

            // desired look at position

            Vector3 lookAtPos;
            if (goTarget != null)
            {
                lookAtPos = !targetPosition.IsNone ?
                    goTarget.transform.TransformPoint(targetPosition.Value) :
                    goTarget.transform.position;
            }
            else
            {
                lookAtPos = targetPosition.Value;
            }

            if (keepVertical.Value)
            {
                lookAtPos.y = go.transform.position.y;
            }

            // smooth look at

            var diff = lookAtPos - go.transform.position;
            if (diff.sqrMagnitude > 0)
            {
                desiredRotation = Quaternion.LookRotation(diff, upVector.IsNone ? Vector3.up : upVector.Value);
            }

            lastRotation = Quaternion.Slerp(lastRotation, desiredRotation, speed.Value * Time.deltaTime);
            go.transform.rotation = lastRotation;

            // debug line to target

            if (debug.Value)
            {
                Debug.DrawLine(go.transform.position, lookAtPos, Color.grey);
            }
        }
 /// Create a new instance with a new timer component
 public AnimationHandler()
 {
   timerComponent = new GameObject();
   timerComponent.transform.name = "Animation Timer";
   var tc = timerComponent.AddComponent<AnimationTimerComponent>();
   tc.handler = this;
 }
Пример #13
0
        void DoSetFsmGameObject()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null)
            {
                return;
            }

            if (go != goLastFrame)
            {
                goLastFrame = go;

                // only get the fsm component if go has changed

                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null)
            {
                return;
            }

            var fsmGameObject = fsm.FsmVariables.GetFsmGameObject(variableName.Value);

            if (fsmGameObject != null)

            {
                fsmGameObject.Value = setValue == null ? null : setValue.Value;
            }
        }
Пример #14
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     pHealth = player.GetComponent<PlayerHealth> ();
     eHealth = GetComponent<EnemyHealth> ();
     eMove = GetComponent<EnemyMovement> ();
 }
Пример #15
0
		void DoAddComponent(GameObject go)
		{
			addedComponent = go.AddComponent(script.Value);

			if (addedComponent == null)
				ActionHelpers.RuntimeError(this, "Can't add script: " + script.Value);
		}
Пример #16
0
 private void Update()
 {
     if(_isGameStarted && mGameSessionGameObject == null)
         mGameSessionGameObject = GameObject.Find("GameSession");
     if(Math.Abs(Time.timeScale) < .25f)
         mMenuGameObject.SetActive(true);
 }
Пример #17
0
        public static void Clear()
        {
            while ( spawnedObjects.Count > 0 )
            {
                if ( spawnedObjects.First.Value.IsInPool )
                    throw new Exception("Object was Despawned incorrectly");

                Despawn( spawnedObjects.First.Value );
            }

            foreach ( var pCollection in poolCollection )
                pCollection.Value.Clear();

            foreach ( var prefabPoolRecord in poolableDict )
                prefabPoolRecord.Value.CurrentAmount = 0;

            poolCollection.Clear();
            poolableDict.Clear();
            spawnedObjects.Clear();

            GameObject.Destroy( gameObject );

            gameObject = new GameObject();
            gameObject.name = "Prefab pool";
            GameObject.DontDestroyOnLoad(gameObject);
        }
        public static int ComputeHull(GameObject gameObject, FracturedObject fracturedObject)
        {
            int nTotalTriangles = 0;

            if(ComputeHull(gameObject, fracturedObject.ConcaveColliderAlgorithm, fracturedObject.ConcaveColliderMaxHulls, fracturedObject.ConcaveColliderMaxHullVertices, fracturedObject.ConcaveColliderLegacySteps, fracturedObject.Verbose, out nTotalTriangles) == false)
            {
                if(fracturedObject.ConcaveColliderAlgorithm == FracturedObject.ECCAlgorithm.Fast)
                {
                    // Fast failed. Try with normal.
                    if(fracturedObject.Verbose)
                    {
                        Debug.Log(gameObject.name + ": Falling back to normal convex decomposition algorithm");
                    }

                    if(ComputeHull(gameObject, FracturedObject.ECCAlgorithm.Normal, fracturedObject.ConcaveColliderMaxHulls, fracturedObject.ConcaveColliderMaxHullVertices, fracturedObject.ConcaveColliderLegacySteps, fracturedObject.Verbose, out nTotalTriangles) == false)
                    {
                        if(fracturedObject.Verbose)
                        {
                            Debug.Log(gameObject.name + ": Falling back to box collider");
                        }
                    }
                }
            }

            return nTotalTriangles;
	    }
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     if (go.GetComponent<Deco>() != null)
     {
         go.GetComponent<Deco>().defaultGridSubdivision = customScenery.GridSubdivision;
     }
 }
Пример #20
0
        void Start()
        {
            container = new GameObject("_ObjectPool");
            if (prefabsToPool == null) return;

            // AUTOPOOL: Find all Destructible objects with DestroyedPrefabs in the scene that have Auto-Pool set to TRUE.
            Destructible[] destructibleObjectsInScene = FindObjectsOfType<Destructible>();
            autoPooledObjects = new Dictionary<int, GameObject>();
            AddDestructibleObjectsToPool(destructibleObjectsInScene);

            // Instantiate game objects from the PrefabsToPool list and add them to the Pool.
            Pool = new GameObject[prefabsToPool.Count][];
            for (int i = 0; i < prefabsToPool.Count; i++)
            {
                PoolEntry poolEntry = prefabsToPool[i];
                Pool[i] = new GameObject[poolEntry.Count];
                for (int n=0; n<poolEntry.Count; n++)
                {
                    if (poolEntry.Prefab == null) continue;
                    var newObj = Instantiate(poolEntry.Prefab);
                    newObj.name = poolEntry.Prefab.name;
                    PoolObject(newObj);
                }
            }
        }
 public static void CreatePulse(MenuCommand menuCommand)
 {
     var pulse = new GameObject("Pulse", typeof(Pulse));
     GameObjectUtility.SetParentAndAlign(pulse, menuCommand.context as GameObject);
     Undo.RegisterCreatedObjectUndo(pulse, "Create " + pulse.name);
     Selection.activeGameObject = pulse;
 }
		void Start(){
			if(cursorIndicatorMode!=_CursorIndicatorMode.None){
				if(indicatorBuildPoint!=null){
					indicatorBuildPoint=(GameObject)Instantiate(indicatorBuildPoint);
					indicatorBuildPoint.transform.localScale=new Vector3(gridSize, 1, gridSize);
					indicatorBuildPoint.transform.parent=transform;
					indicatorBuildPoint.SetActive(false);
					indicatorCursor.name="TileIndicator_BuildPoint";
					
					foreach(Transform child in indicatorBuildPoint.transform) 
						indicatorBuildPointRen=child.GetComponent<Renderer>();
				}
				
				if(indicatorCursor!=null){
					indicatorCursor=(GameObject)Instantiate(indicatorCursor);
					indicatorCursor.transform.localScale=new Vector3(gridSize, 1, gridSize);
					indicatorCursor.transform.parent=transform;
					indicatorCursor.SetActive(false);
					indicatorCursor.name="TileIndicator_Cursor";
					
					foreach(Transform child in indicatorCursor.transform) 
						indicatorCursorRen=child.GetComponent<Renderer>();
				}
			}
			
			InitiateSampleTowerList();
		}
Пример #23
0
 public void PickupCoin(GameObject coin)
 {
     this._pickupSound.Play();
     Player.Instance.Points += 10;
     DestroyObject(coin);
     this.CreateNewCoin();
 }
 //property nodes
 
 //method nodes
 #pragma warning restore 414
 
 //functions to refresh properties from entities
 
 void SyncUnityHooks( )
 {
    SyncEventListeners( );
    if ( null == local_3_UnityEngine_GameObject || false == m_RegisteredForEvents )
    {
       local_3_UnityEngine_GameObject = GameObject.Find( "LeftHandTouch" ) as UnityEngine.GameObject;
    }
    //if our game object reference was changed then we need to reset event listeners
    if ( local_3_UnityEngine_GameObject_previous != local_3_UnityEngine_GameObject || false == m_RegisteredForEvents )
    {
       //tear down old listeners
       
       local_3_UnityEngine_GameObject_previous = local_3_UnityEngine_GameObject;
       
       //setup new listeners
    }
    if ( null == local_4_UnityEngine_GameObject || false == m_RegisteredForEvents )
    {
       local_4_UnityEngine_GameObject = GameObject.Find( "RightHandTouch" ) as UnityEngine.GameObject;
    }
    //if our game object reference was changed then we need to reset event listeners
    if ( local_4_UnityEngine_GameObject_previous != local_4_UnityEngine_GameObject || false == m_RegisteredForEvents )
    {
       //tear down old listeners
       
       local_4_UnityEngine_GameObject_previous = local_4_UnityEngine_GameObject;
       
       //setup new listeners
    }
 }
Пример #25
0
 void SpawnCloud()
 {
     if (BoilerLid.lidIsOpen)
     {
         spawnedCloud = Instantiate(cloudToSpawn, new Vector3(-5.02f, 18.8f, 5.03f), transform.rotation) as GameObject;
     }
 }
        private void OnParticleCollision(GameObject other)
        {
            int safeLength = m_ParticleSystem.GetSafeCollisionEventSize();

            if (m_CollisionEvents.Length < safeLength)
            {
                m_CollisionEvents = new ParticleCollisionEvent[safeLength];
            }

            int numCollisionEvents = m_ParticleSystem.GetCollisionEvents(other, m_CollisionEvents);
            int i = 0;

            while (i < numCollisionEvents)
            {
                if (Time.time > lastSoundTime + 0.2f)
                {
                    lastSoundTime = Time.time;
                }

                var col = m_CollisionEvents[i].collider;
                var attachedRigidbody = col.GetComponent<Rigidbody>();
                if (attachedRigidbody != null)
                {
                    Vector3 vel = m_CollisionEvents[i].velocity;
                    attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);
                }

                other.BroadcastMessage("Extinguish", SendMessageOptions.DontRequireReceiver);

                i++;
            }
        }
Пример #27
0
        // crea un chunk nella posizione indicata
        internal static Chunk CreateChunkAt(Vector3 posChunk, GameObject chunckContainer, int sizeChunk)
        {
            GameObject newChunk = new GameObject("chunck " + posChunk.x + " " + posChunk.y + " " + posChunk.z);
            newChunk.transform.parent = chunckContainer.transform;

            return Chunk.CreateComponent(newChunk, posChunk, sizeChunk);
        }
		void SetTag(GameObject parent)
		{
			if (parent == null)
			{
				return;
			}

            if (string.IsNullOrEmpty(filterByComponent.Value)) // do all children
            {
                foreach (Transform child in parent.transform)
                {
                    child.gameObject.tag = tag.Value;
                }
            }
            else
            {
                UpdateComponentFilter();

                if (componentFilter != null) // filter by component
                {
                    var root = parent.GetComponentsInChildren(componentFilter);
                    foreach (var child in root)
                    {
                        child.gameObject.tag = tag.Value;
                    }
                }
            }

			Finish();
		}
Пример #29
0
		public bool GetActive(GameObject go){
			#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5	
			return go.active;
			#else
			return go.activeInHierarchy;
			#endif			
		}
Пример #30
0
		public void SetActiveRecursively(GameObject go, bool isActive){
			#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5	
			go.SetActiveRecursively(isActive);
			#else
			go.SetActive(isActive);
			#endif
		}
Пример #31
0
    static int AddChild(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.GameObject o    = NGUITools.AddChild(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.GameObject)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.ToObject(L, 2);
                UnityEngine.GameObject o    = NGUITools.AddChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(bool)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                bool arg1 = LuaDLL.lua_toboolean(L, 2);
                UnityEngine.GameObject o = NGUITools.AddChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NGUITools.AddChild"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #32
0
    static int Move(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 13);
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
            System.Nullable <UnityEngine.Vector3> arg1 = (System.Nullable <UnityEngine.Vector3>)ToLua.CheckVarObject(L, 2, typeof(System.Nullable <UnityEngine.Vector3>));
            UnityEngine.Vector3 arg2         = (UnityEngine.Vector3)ToLua.CheckObject(L, 3, typeof(UnityEngine.Vector3));
            float                 arg3       = (float)LuaDLL.luaL_checknumber(L, 4);
            float                 arg4       = (float)LuaDLL.luaL_checknumber(L, 5);
            bool                  arg5       = LuaDLL.luaL_checkboolean(L, 6);
            InterpType            arg6       = (InterpType)ToLua.CheckObject(L, 7, typeof(InterpType));
            bool                  arg7       = LuaDLL.luaL_checkboolean(L, 8);
            RepeatType            arg8       = (RepeatType)ToLua.CheckObject(L, 9, typeof(RepeatType));
            int                   arg9       = (int)LuaDLL.luaL_checknumber(L, 10);
            UnityEngine.Transform arg10      = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 11, typeof(UnityEngine.Transform));
            AnimCallBack          arg11      = null;
            LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

            if (funcType12 != LuaTypes.LUA_TFUNCTION)
            {
                arg11 = (AnimCallBack)ToLua.CheckObject(L, 12, typeof(AnimCallBack));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 12);
                arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
            }

            object[] arg12 = ToLua.CheckObjectArray(L, 13);
            AnimData o     = AnimSystem.Move(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #33
0
    private System.Collections.IEnumerator follow(GO other, Dir moveDir)
    {
        bool isOtherOnLedge = false;

        if (moveDir != this.facing)
        {
            this.turn(moveDir);
            yield return(new UnityEngine.WaitForFixedUpdate());

            while ((this.anim & Animation.Turn) != 0)
            {
                yield return(new UnityEngine.WaitForFixedUpdate());
            }
        }

        this.issueEvent <OnLedgeDetector>(
            (x, y) => x.Check(out isOtherOnLedge), other);
        if (!isOtherOnLedge)
        {
            this.tryMoveForward(this.MoveDelay);
        }
    }
Пример #34
0
    private void PlayUnLock(UnityEngine.GameObject button)
    {
        //for (int i = 0; i < buttons.Count; i++) {
        //  TrialUnit unit = buttons[i].GetComponent<TrialUnit>();
        //  if (unit != null) {
        //    if (unit.HasOpen) {//播放第一个为开放的(等级从大到小排的序)
        //      unit.PlayUnLock();
        //      break;
        //    }
        //  }
        //}
        TrialUnit unit = button.GetComponent <TrialUnit>();

        if (unit != null)
        {
            if (unit.HasOpen)
            {//播放第一个为开放的(等级从大到小排的序)
                //unit.PlayUnLock();
                unit.UnLockFinish();
            }
        }
    }
Пример #35
0
    //plays an audio clip based on the options mentioned.//
    void playAudio(string name, string option)
    {
        //name and option verification.//
        name = name.Replace("\"", "");
        int index = -1;

        for (int i = 0; i < Data.data.sounds.Length; i++)
        {
            if (Data.data.sounds[i].rcname == name)
            {
                index = i; break;
            }
        }
        if (index < 0)
        {
            UnityEngine.Debug.Log(name + " audio clip not found!!!"); return;
        }
        if (option != "once" && option != "repeat")
        {
            UnityEngine.Debug.Log("invalid option " + option + "!!!"); return;
        }

        //creating a gameobject to play audio and destroying after finished playing.//
        UnityEngine.GameObject  audio = new UnityEngine.GameObject("audio player");
        UnityEngine.AudioSource src   = audio.AddComponent <UnityEngine.AudioSource>();
        if (option == "once")
        {
            src.PlayOneShot(Data.data.sounds[index].clip);
            DestroyScript ds = audio.AddComponent <DestroyScript>();
            ds.setTime(Data.data.sounds[index].clip.length + 5);
        }
        else
        {
            src.clip = Data.data.sounds[index].clip;
            src.Play();
            src.loop = true;
        }
    }
Пример #36
0
    // Use this for initialization
    void Start()
    {
        try
        {
            goEffect = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/YesOrNot/Changjing") as UnityEngine.GameObject;
            object obj = null;
            obj = LogicSystem.EventChannelForGfx.Subscribe <string>("pve_boss_enter", "ui_effect", OnBossEnter);
            if (obj != null)
            {
                m_EventList.Add(obj);
            }
            obj = LogicSystem.EventChannelForGfx.Subscribe("ge_ui_unsubscribe", "ui", UnSubscribe);
            if (obj != null)
            {
                m_EventList.Add(obj);
            }
            obj = LogicSystem.EventChannelForGfx.Subscribe <string, int, int>("pve_checkpoint_begin", "ui_effect", OnSceneBegin);
            if (obj != null)
            {
                m_EventList.Add(obj);
            }
            obj = LogicSystem.EventChannelForGfx.Subscribe <int>("pve_area_clear", "ui_effect", OnAreaClear);

            if (obj != null)
            {
                m_EventList.Add(obj);
            }
            obj = LogicSystem.EventChannelForGfx.Subscribe <int>("pve_checkpoint_type", "ui_effect", OnCheckpointTypeEffect);
            if (obj != null)
            {
                m_EventList.Add(obj);
            }
        }
        catch (System.Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace);
        }
    }
Пример #37
0
    static int AlphaTo(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 12);
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
            float        arg1           = (float)LuaDLL.luaL_checknumber(L, 2);
            float        arg2           = (float)LuaDLL.luaL_checknumber(L, 3);
            float        arg3           = (float)LuaDLL.luaL_checknumber(L, 4);
            float        arg4           = (float)LuaDLL.luaL_checknumber(L, 5);
            InterpType   arg5           = (InterpType)ToLua.CheckObject(L, 6, typeof(InterpType));
            bool         arg6           = LuaDLL.luaL_checkboolean(L, 7);
            RepeatType   arg7           = (RepeatType)ToLua.CheckObject(L, 8, typeof(RepeatType));
            int          arg8           = (int)LuaDLL.luaL_checknumber(L, 9);
            bool         arg9           = LuaDLL.luaL_checkboolean(L, 10);
            AnimCallBack arg10          = null;
            LuaTypes     funcType11     = LuaDLL.lua_type(L, 11);

            if (funcType11 != LuaTypes.LUA_TFUNCTION)
            {
                arg10 = (AnimCallBack)ToLua.CheckObject(L, 11, typeof(AnimCallBack));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 11);
                arg10 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
            }

            object[] arg11 = ToLua.CheckObjectArray(L, 12);
            AnimData o     = AnimSystem.AlphaTo(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.GameObject o;
         if (argc == 2)
         {
             System.String a1;
             checkType(l, 2, out a1);
             o = new UnityEngine.GameObject(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 1)
         {
             o = new UnityEngine.GameObject();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 3)
         {
             System.String a1;
             checkType(l, 2, out a1);
             System.Type[] a2;
             checkParams(l, 3, out a2);
             o = new UnityEngine.GameObject(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #39
0
            public void playGlobal(Vec3 position, Transform parent)
            {
                if (Global.Sfx.sfxVolume <= 0.0f)
                {
                    return;
                }

                GO obj = new GO();

                // Center in parent
                obj.transform.parent   = parent;
                obj.transform.position = position;

                AudioSource player = obj.AddComponent <AudioSource>();

                player.clip         = this.src;
                player.spatialBlend = 1.0f; // full-3D
                player.minDistance  = 0.5f;
                player.maxDistance  = 10.0f;
                player.volume       = Global.Sfx.sfxVolume;
                player.Play();
                obj.AddComponent <DestroyOnAudioDone>();
            }
Пример #40
0
    static int Listen(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5)
            {
                UIEventListener        obj  = (UIEventListener)ToLua.CheckObject <UIEventListener>(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
                UnityEngine.EventSystems.EventTriggerType arg1 = (UnityEngine.EventSystems.EventTriggerType)ToLua.CheckObject(L, 3, typeof(UnityEngine.EventSystems.EventTriggerType));
                object      arg2 = ToLua.ToVarObject(L, 4);
                LuaFunction arg3 = ToLua.CheckLuaFunction(L, 5);
                obj.Listen(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 6)
            {
                UIEventListener        obj  = (UIEventListener)ToLua.CheckObject <UIEventListener>(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
                UnityEngine.EventSystems.EventTriggerType arg1 = (UnityEngine.EventSystems.EventTriggerType)ToLua.CheckObject(L, 3, typeof(UnityEngine.EventSystems.EventTriggerType));
                object      arg2 = ToLua.ToVarObject(L, 4);
                LuaFunction arg3 = ToLua.CheckLuaFunction(L, 5);
                object      arg4 = ToLua.ToVarObject(L, 6);
                obj.Listen(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIEventListener.Listen"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int _CreateUnityEngine_GameObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.GameObject obj = new UnityEngine.GameObject();
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.GameObject obj = new UnityEngine.GameObject(arg0);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else if (TypeChecker.CheckTypes <string>(L, 1) && TypeChecker.CheckParamsType <System.Type>(L, 2, count - 1))
            {
                string                 arg0 = ToLua.ToString(L, 1);
                System.Type[]          arg1 = ToLua.ToParamsObject <System.Type>(L, 2, count - 1);
                UnityEngine.GameObject obj  = new UnityEngine.GameObject(arg0, arg1);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.GameObject.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #42
0
    /// <summary>
    /// Gets the next suitable inactive object in the pool. Instiates a new one if none is available.
    /// </summary>
    /// <returns>The next suitable inactive object from the pool.</returns>
    /// <param name="instance">Instance.</param>
    /// <param name="pool">Pool.</param>
    /// <param name="isElementSuitable">Predicate to determine if an inactive item in the pool is suitable.</param>
    /// <param name="prefab">
    /// Prefab to instantiate if no candidate can be found. If null, then an empty GameObject with the component
    /// will be created and used.
    /// </param>
    /// <param name="parent">Parent.</param>
    /// <typeparam name="T">The type of object in the pool.</typeparam>
    public static T GetFromPool <T>(
        this UnityEngine.Object instance,
        List <T> pool,
        System.Predicate <T> isElementSuitable,
        T prefab,
        UnityEngine.Transform parent = null
        ) where T : UnityEngine.Component
    {
        T result;

        if (isElementSuitable != null)
        {
            result = pool.Find((item) => item.gameObject.activeSelf == false && isElementSuitable(item));
        }
        else
        {
            result = pool.Find((item) => item != null && item.gameObject.activeSelf == false);
        }
        if (result == null)
        {
            if (prefab == null)
            {
                result = new UnityEngine.GameObject(
                    string.Format("<{0} pooled {1} {2}>", instance.name, typeof(T).FullName, pool.Count), typeof(T)
                    ).GetComponent <T>();
            }
            else
            {
                result = UnityEngine.Object.Instantiate(prefab) as T;
            }
            result.transform.SetParent(parent, false);
            result.transform.SetAsLastSibling();
            pool.Add(result);
        }
        result.gameObject.SetActive(true);
        return(result);
    }
Пример #43
0
    static int GetComponentsInParent(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.GetComponentsInParent(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.GetComponentsInParent(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInParent"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int _CreateFairyGUI_Container(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FairyGUI.Container obj = new FairyGUI.Container();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <UnityEngine.GameObject>(L, 1))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                FairyGUI.Container     obj  = new FairyGUI.Container(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
            {
                string             arg0 = ToLua.ToString(L, 1);
                FairyGUI.Container obj  = new FairyGUI.Container(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.Container.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int SendMessage(IntPtr L)
    {
        IntPtr L0 = LuaException.L;

        try
        {
            ++LuaException.SendMsgCount;
            LuaException.L = L;
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <string>(L, 2))
            {
                UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                string arg0 = ToLua.ToString(L, 2);
                obj.SendMessage(arg0);

                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))
                {
                    string error = LuaDLL.lua_tostring(L, -1);
                    LuaDLL.lua_pop(L, 1);
                    throw new LuaException(error, LuaException.GetLastError());
                }

                --LuaException.SendMsgCount;
                LuaException.L = L0;
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, UnityEngine.SendMessageOptions>(L, 2))
            {
                UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                string arg0 = ToLua.ToString(L, 2);
                UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3);
                obj.SendMessage(arg0, arg1);

                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))
                {
                    string error = LuaDLL.lua_tostring(L, -1);
                    LuaDLL.lua_pop(L, 1);
                    throw new LuaException(error, LuaException.GetLastError());
                }

                --LuaException.SendMsgCount;
                LuaException.L = L0;
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, object>(L, 2))
            {
                UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                string arg0 = ToLua.ToString(L, 2);
                object arg1 = ToLua.ToVarObject(L, 3);
                obj.SendMessage(arg0, arg1);

                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))
                {
                    string error = LuaDLL.lua_tostring(L, -1);
                    LuaDLL.lua_pop(L, 1);
                    throw new LuaException(error, LuaException.GetLastError());
                }

                --LuaException.SendMsgCount;
                LuaException.L = L0;
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes <string, object, UnityEngine.SendMessageOptions>(L, 2))
            {
                UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
                string arg0 = ToLua.ToString(L, 2);
                object arg1 = ToLua.ToVarObject(L, 3);
                UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4);
                obj.SendMessage(arg0, arg1, arg2);

                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))
                {
                    string error = LuaDLL.lua_tostring(L, -1);
                    LuaDLL.lua_pop(L, 1);
                    throw new LuaException(error, LuaException.GetLastError());
                }

                --LuaException.SendMsgCount;
                LuaException.L = L0;
                return(0);
            }
            else
            {
                --LuaException.SendMsgCount;
                LuaException.L = L0;
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessage"));
            }
        }
        catch (Exception e)
        {
            --LuaException.SendMsgCount;
            LuaException.L = L0;
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #46
0
 /// <summary>
 ///     The hash function used to convert a Unity Game Object into an AkGameObjectID used by the sound engine.
 /// </summary>
 public static ulong GetAkGameObjectID(UnityEngine.GameObject gameObject)
 {
     return(gameObjectHash(gameObject));
 }
 static public int BroadcastMessage(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.String          a1;
             checkType(l, 2, out a1);
             self.BroadcastMessage(a1);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.SendMessageOptions)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.String          a1;
             checkType(l, 2, out a1);
             UnityEngine.SendMessageOptions a2;
             a2 = (UnityEngine.SendMessageOptions)LuaDLL.luaL_checkinteger(l, 3);
             self.BroadcastMessage(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(System.Object)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.String          a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             self.BroadcastMessage(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.String          a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             UnityEngine.SendMessageOptions a3;
             a3 = (UnityEngine.SendMessageOptions)LuaDLL.luaL_checkinteger(l, 4);
             self.BroadcastMessage(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function BroadcastMessage 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
 }
Пример #48
0
 public void Get(out GO player)
 {
     player = this.playerInstance;
 }
Пример #49
0
 static public int AddChild(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             var ret = self.AddChild <UnityEngine.Component>();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             var ret = self.AddChild();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.GameObject)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             UnityEngine.GameObject a2;
             checkType(l, 2, out a2);
             var ret = self.AddChild(a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(bool)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Boolean         a2;
             checkType(l, 2, out a2);
             var ret = self.AddChild <UnityEngine.Component>(a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Int32           a2;
             checkType(l, 2, out a2);
             var ret = self.AddChild(a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(bool)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Boolean         a2;
             checkType(l, 2, out a2);
             var ret = self.AddChild(a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(bool), typeof(int)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             System.Boolean         a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = self.AddChild(a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.GameObject), typeof(int)))
         {
             UnityEngine.GameObject self = (UnityEngine.GameObject)checkSelf(l);
             UnityEngine.GameObject a2;
             checkType(l, 2, out a2);
             System.Int32 a3;
             checkType(l, 3, out a3);
             var ret = self.AddChild(a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function AddChild to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #50
0
    static int BezierMove(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(RepeatType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float                 arg2      = (float)LuaDLL.lua_tonumber(L, 3);
                InterpType            arg3      = (InterpType)ToLua.ToObject(L, 4);
                RepeatType            arg4      = (RepeatType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2     = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3      = (float)LuaDLL.lua_tonumber(L, 4);
                InterpType            arg4      = (InterpType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                float        arg4           = (float)LuaDLL.lua_tonumber(L, 5);
                InterpType   arg5           = (InterpType)ToLua.ToObject(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(InterpType), typeof(float), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float        arg2           = (float)LuaDLL.lua_tonumber(L, 3);
                RepeatType   arg3           = (RepeatType)ToLua.ToObject(L, 4);
                InterpType   arg4           = (InterpType)ToLua.ToObject(L, 5);
                float        arg5           = (float)LuaDLL.lua_tonumber(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(RepeatType), typeof(int), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1      = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2      = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3       = (float)LuaDLL.lua_tonumber(L, 4);
                float                 arg4       = (float)LuaDLL.lua_tonumber(L, 5);
                RepeatType            arg5       = (RepeatType)ToLua.ToObject(L, 6);
                int                   arg6       = (int)LuaDLL.lua_tonumber(L, 7);
                InterpType            arg7       = (InterpType)ToLua.ToObject(L, 8);
                bool                  arg8       = LuaDLL.lua_toboolean(L, 9);
                PathType              arg9       = (PathType)ToLua.ToObject(L, 10);
                UnityEngine.Vector3[] arg10      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 11);
                AnimCallBack          arg11      = null;
                LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(int), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                RepeatType   arg4           = (RepeatType)ToLua.ToObject(L, 5);
                int          arg5           = (int)LuaDLL.lua_tonumber(L, 6);
                float        arg6           = (float)LuaDLL.lua_tonumber(L, 7);
                InterpType   arg7           = (InterpType)ToLua.ToObject(L, 8);
                bool         arg8           = LuaDLL.lua_toboolean(L, 9);
                PathType     arg9           = (PathType)ToLua.ToObject(L, 10);
                float[]      arg10          = ToLua.CheckNumberArray <float>(L, 11);
                AnimCallBack arg11          = null;
                LuaTypes     funcType12     = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: AnimSystem.BezierMove"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #51
0
    /// <summary>
    /// Called when this part modifiers is being initialized as the part game object is being created.
    /// </summary>
    /// <param name="partRootObject">The root game object that has been created for the part.</param>
    /// <returns>The created part modifier behaviour, or <c>null</c> if it was not created.</returns>
    public override Jundroo.SimplePlanes.ModTools.Parts.PartModifierBehaviour Initialize(UnityEngine.GameObject partRootObject)
    {
        // Attach the behaviour to the part's root object.
        var behaviour = partRootObject.AddComponent <TVC_v2Behaviour>();

        return(behaviour);
    }
Пример #52
0
 private void SyncMars(List <GowDataForMsg> marslist)
 {
     try
     {
         if (marslist != null)
         {
             int mlcount = marslist.Count;
             int glcount = golist.Count;
             UnityEngine.GameObject item = UIManager.Instance.GetWindowGoByName("Ranking");
             UnityEngine.Transform  tfr  = item.transform.Find("ScrollView2/Grid");
             if (tfr == null)
             {
                 return;
             }
             for (int i = 0; i < mlcount; ++i)
             {
                 if (i < glcount)
                 {
                     UnityEngine.GameObject go = golist[i];
                     if (go != null)
                     {
                         GowDataForMsg gdfm = marslist[i];
                         if (gdfm != null)
                         {
                             SetMarsCellInfo(go, gdfm, i);
                         }
                     }
                 }
                 else
                 {
                     UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Mars/MarsCell"));
                     if (go != null)
                     {
                         go = NGUITools.AddChild(tfr.gameObject, go);
                         if (go != null)
                         {
                             golist.Add(go);
                             GowDataForMsg gdfm = marslist[i];
                             if (gdfm != null)
                             {
                                 SetMarsCellInfo(go, gdfm, i);
                             }
                         }
                     }
                 }
             }
             if (glcount > mlcount)
             {
                 for (int j = mlcount; j < glcount; ++j)
                 {
                     UnityEngine.GameObject go = golist[j];
                     if (go != null)
                     {
                         NGUITools.DestroyImmediate(go);
                     }
                 }
                 golist.RemoveRange(mlcount, glcount - mlcount);
             }
             UIGrid ug = tfr.gameObject.GetComponent <UIGrid>();
             if (ug != null)
             {
                 ug.repositionNow = true;
             }
         }
     }
     catch (Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Пример #53
0
 private void SetMarsCellInfo(UnityEngine.GameObject go, GowDataForMsg gdfm, int order)
 {
     if (go != null && gdfm != null)
     {
         UnityEngine.Transform tf = go.transform.Find("Label4/Sprite");
         if (tf != null)
         {
             UISprite us = tf.gameObject.GetComponent <UISprite>();
             if (us != null)
             {
                 us.spriteName = "no" + (order + 1);
             }
         }
         tf = go.transform.Find("Head");
         if (tf != null)
         {
             UISprite us = tf.gameObject.GetComponent <UISprite>();
             if (us != null)
             {
                 Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(gdfm.m_Heroid);
                 us.spriteName = cg.m_PortraitForCell;
             }
         }
         tf = go.transform.Find("Label0");
         if (tf != null)
         {
             UILabel ul = tf.gameObject.GetComponent <UILabel>();
             if (ul != null)
             {
                 ul.text = "Lv." + gdfm.m_Level;
             }
         }
         tf = go.transform.Find("Label1");
         if (tf != null)
         {
             UILabel ul = tf.gameObject.GetComponent <UILabel>();
             if (ul != null)
             {
                 ul.text = gdfm.m_FightingScore.ToString();
             }
         }
         tf = go.transform.Find("Label2");
         if (tf != null)
         {
             UILabel ul = tf.gameObject.GetComponent <UILabel>();
             if (ul != null)
             {
                 ul.text = gdfm.m_GowElo.ToString();
             }
         }
         tf = go.transform.Find("Label3");
         if (tf != null)
         {
             UILabel ul = tf.gameObject.GetComponent <UILabel>();
             if (ul != null)
             {
                 ul.text = gdfm.m_Nick;
             }
         }
         tf = go.transform.Find("Label4");
         if (tf != null)
         {
             UILabel ul = tf.gameObject.GetComponent <UILabel>();
             if (ul != null)
             {
                 if (order + 1 < 4)
                 {
                     ul.text = "NOD" + (char)('A' + order);
                 }
                 else
                 {
                     ul.text = (order + 1).ToString() + "ETH";
                 }
             }
         }
     }
 }
Пример #54
0
 /// <summary>
 ///     User hook called after UnregisterGameObj(). An example use could be to remove the id and gameObject from a
 ///     dictionary upon AK_Success.
 /// </summary>
 /// <param name="result">The result from calling UnregisterGameObj() on gameObject.</param>
 /// <param name="gameObject">The GameObject that UnregisterGameObj() was called on.</param>
 /// <param name="id">The ulong returned from GameObjectHash that represents this GameObject in Wwise.</param>
 static partial void PostUnregisterGameObjUserHook(AKRESULT result, UnityEngine.GameObject gameObject, ulong id);
Пример #55
0
 /// <summary>
 ///     User hook called within all Wwise integration functions that receive GameObjects and do not perform
 ///     (un)registration. This is called
 ///     before values are sent to the native plugin code. An example use could be to register game objects that were not
 ///     previously registered.
 /// </summary>
 /// <param name="gameObject">The GameObject being processed.</param>
 /// <param name="id">The ulong returned from GameObjectHash that represents this GameObject in Wwise.</param>
 static partial void PreGameObjectAPICallUserHook(UnityEngine.GameObject gameObject, ulong id);
Пример #56
0
 public void JustDropped(GO other)
 {
     this.updateCrackedStateEnter();
 }
Пример #57
0
 //init里获得 view的各个组件
 public abstract void Init(UnityEngine.GameObject go, int index);
Пример #58
0
 private static ulong InternalGameObjectHash(UnityEngine.GameObject gameObject)
 {
     return(gameObject == null ? AK_INVALID_GAME_OBJECT : (ulong)gameObject.GetInstanceID());
 }
Пример #59
0
 public UnityEngine.GameObject createGameObject()
 {
     UnityEngine.GameObject go = new UnityEngine.GameObject();
     go.name = "HC";
     return(go);
 }
Пример #60
0
 public static void PreGameObjectAPICall(UnityEngine.GameObject gameObject, ulong id)
 {
     PreGameObjectAPICallUserHook(gameObject, id);
 }