Inheritance: GUIElement
Example #1
0
 // Use this for initialization
 void Start()
 {
     MGC.Instance.logger.addEntry("start Stand Alone Social Game");
     GUITex = gameObject.GetComponent<GUITexture>();
     GUITex.texture = icon;
     Resize();
 }
Example #2
0
 void Awake() {
     this._guiTexture = this.transform.GetComponent<GUITexture>() as GUITexture;
     this._currentFrame = 0;
     this._frameCount = textures.Count;
     this._guiTexture.texture = this.textures[this._currentFrame];
     //this.gameObject.SetActive(false);
 }
Example #3
0
        public string PopMessage(GUITexture t)
        {
            int i = messageHUDObjects.IndexOf(t);

            string s = messages[i];
            messages.RemoveAt(i);
            GameObject.Destroy(messageHUDObjects[i].gameObject);
            messageHUDObjects.RemoveAt(i);

            return s;
        }
        void Start()
        {
            CurrentData = null;
            HasNewData = false;
            
            newWidth = Screen.width;
            newHeight = Screen.height;
            newResolution = true;

            m_guitexture = GetComponent<GUITexture>();
        }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.GUITexture o;
			o=new UnityEngine.GUITexture();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int get_pixelInset(IntPtr l)
 {
     try {
         UnityEngine.GUITexture self = (UnityEngine.GUITexture)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.pixelInset);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.GUITexture o;
         o=new UnityEngine.GUITexture();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.GUITexture o;
         o = new UnityEngine.GUITexture();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #9
0
        public override Status Update () {
            // Get the gui texture
            if (m_SetGUITexture == null || m_SetGUITexture.gameObject != gameObject.Value)
                m_SetGUITexture = gameObject.Value != null ? gameObject.Value.GetComponent<GUITexture>() : null;

            // Validate members
            if (m_SetGUITexture == null)
                return Status.Error;

            if (!newTexture.isNone) m_SetGUITexture.texture = newTexture.Value;
            if (!newColor.isNone) m_SetGUITexture.color = newColor.Value;
            
            return Status.Success;
        }
 static public int set_texture(IntPtr l)
 {
     try {
         UnityEngine.GUITexture self = (UnityEngine.GUITexture)checkSelf(l);
         UnityEngine.Texture    v;
         checkType(l, 2, out v);
         self.texture = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_pixelInset(IntPtr l)
 {
     try {
         UnityEngine.GUITexture self = (UnityEngine.GUITexture)checkSelf(l);
         UnityEngine.Rect       v;
         checkValueType(l, 2, out v);
         self.pixelInset = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #12
0
 static void GUITexture_border(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.GUITexture _this = (UnityEngine.GUITexture)vc.csObj;
         var result = _this.border;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.RectOffset arg0  = (UnityEngine.RectOffset)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.GUITexture _this = (UnityEngine.GUITexture)vc.csObj;
         _this.border = arg0;
     }
 }
        private void Awake() {
            if(SystemInfo.deviceType == DeviceType.Handheld) allowMouseControl = false; // disable mouse control on touch devices

            gui = GetComponent<GUITexture>();
            if(gui.texture == null) {
                Debug.LogError("TouchButton object requires a valid texture!");
                gameObject.SetActive(false);
                return;
            }

            origPixelInset = gui.pixelInset; // store the original pixel inset
            origTransformPosition = transform.position; // store the original transform position

            RefreshPosition();

        }
    static int get_guiTexture(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Component  obj = (UnityEngine.Component)o;
            UnityEngine.GUITexture ret = obj.guiTexture;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index guiTexture on a nil value" : e.Message));
        }
    }
Example #15
0
    static int get_guiTexture(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.GameObject obj = (UnityEngine.GameObject)o;
            UnityEngine.GUITexture ret = obj.guiTexture;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index guiTexture on a nil value"));
        }
    }
Example #16
0
        /// <summary>
        /// Use this for initialization
        /// </summary>
        public void Start()
        {
            Transform reticule = gameObject.transform.Find("Reticule");

            if (reticule == null)
            {
                Debug.LogError("No \"Reticule\" game object found");
            }
            _reticuleTexture            = reticule.gameObject.GetComponent <GUITexture>();
            _reticuleTexture.pixelInset = new Rect(Screen.width / 2, Screen.height / 2, 16, 16);

            _feelingTextureMap = new Dictionary <string, Texture2D>();
            _demandTextureMap  = new Dictionary <string, Texture2D>();

            ConstructForceTexture();

            System.Console.WriteLine(OCLogSymbol.DETAILEDINFO + gameObject.name + " is started.");
        }
Example #17
0
        void Awake() {
#if UNITY_IPHONE || UNITY_ANDROID
            this._disableTouch = false;
#else
            this._disableTouch = true;
#endif

            this._objectTexture = this.transform.guiTexture;
            this.transform.position = new Vector3(0.0f, 0.0f, 0.1f);
            this._objectTexture.texture = this.buttonExit;

            if(GameController.instance.isStageFinished) {
                switch(this.buttonType) {
                    case GameMenuInfo.ButtonTypes.RESTART:
                        this._objectTexture.pixelInset = GameMenuInfo.EndRestartButtonRect;
                        break;

                    case GameMenuInfo.ButtonTypes.MAINMENU:
                        this._objectTexture.pixelInset = GameMenuInfo.EndMainMenuButtonRect;
                        break;

                    case GameMenuInfo.ButtonTypes.NEXTLEVEL:
                        this._objectTexture.pixelInset = GameMenuInfo.EndNextLevelButtonRect;
                        break;
                }
            } else {
                switch(this.buttonType) {
                    case GameMenuInfo.ButtonTypes.RESTART:
                        this._objectTexture.pixelInset = GameMenuInfo.RestartButtonRect;
                        break;

                    case GameMenuInfo.ButtonTypes.MAINMENU:
                        this._objectTexture.pixelInset = GameMenuInfo.MainMenuButtonRect;
                        break;

                    case GameMenuInfo.ButtonTypes.UNDO:
                        this.transform.gameObject.SetActive(false);
                        this._objectTexture.pixelInset = GameMenuInfo.UndoButtonRect;
                        break;
                }
            }
        }
Example #18
0
        void Awake() {
            this._transitionTexture = this.transform.GetComponent<GUITexture>() as GUITexture;

            this.transform.position = new Vector3(0.5f, 0.5f, 1.0f);
            this._transitionTexture.pixelInset = new Rect(0.0f, 0.0f, GlobalInfo.ScreenWidth, GlobalInfo.ScreenHeight);

            this._minColor = new Color(0.5f, 0.5f, 0.5f, this._alphaMinValue);
            this._maxColor = new Color(0.5f, 0.5f, 0.5f, this._alphaMaxValue);

            if(this.fadeToMax) {
                this._transitionTexture.color = this._minColor;
                this._alpha = this._alphaMinValue;
            } else {
                this._transitionTexture.color = this._maxColor;
                this._alpha = this._alphaMaxValue;
            }

            if(!this.isActive)
                this.gameObject.SetActive(false);
        }
Example #19
0
        // Use this for initialization
        void Start ()
        {
            Scene = new RSScene(Host, Port, Timeout);
            Scene.Filename = SceneFilename;
            Scene.OnAppIniting += new ApplicationInitialisingCallback(OnAppInitingCallback);
            
            Viewport = new RSViewport(Scene);	
            Viewport.UseRenderLoop = UseRenderLoop;
            Viewport.RenderLoopHandler = RenderLoopHandler;
            Viewport.Renderer = Renderer;
            Viewport.RenderTarget = RenderTarget;
            Viewport.RenderLoopInterval = RenderLoopInterval;
            Viewport.OnRestartRender += new RSViewport.RestartRenderCallback(OnRestartRender);
            Viewport.OnRender += new ResponseHandler(OnRender);

            Logger.OnLog += new Logger.LogHandler(onLog);

            //Cache gui texture
            if(RenderTarget !=null)
            m_RenderTexture = RenderTarget.GetComponent<GUITexture>();
        }
Example #20
0
        void Awake() {
            instance = this;
            this._gridMap = GameObject.FindGameObjectWithTag("GridMap").gameObject;
            GameController.FindOrCreate();
            GameMenuController.FindOrCreate();
            GameController.instance.PrepareNextLevel();
            GameMenuController.instance.fade.PlayFadeToMin();
            this._explosionPosition = new Vector3(GridMap.instance.columns * 0.5f, 0.5f, GridMap.instance.rows * 0.5f);
            this._explosionRadius = (GridMap.instance.rows * GridMap.instance.columns);

            this._warningTexture = ((GameObject)Instantiate(ResourceManager.instance.warningTexture) as GameObject).GetComponent<GUITexture>();
            this._warningTexture.pixelInset = new Rect(0.0f, 0.0f, GlobalInfo.ScreenWidth, GlobalInfo.ScreenHeight);
            this.warningColor = new Color(0.8f, 0.1f, 0.1f, 0.0f);
            this._warningTexture.color = this.warningColor;

            this.gameObject.AddComponent<GridAudio>();

#if UNITY_IPHONE || UNITY_ANDROID
            this.transform.gameObject.AddComponent<SwipeInput>();
            this._swipeController = this.transform.GetComponent<SwipeInput>() as SwipeInput;
#endif
        }
        public void Start()
        {
            // Get the values of the parameters:
            direction = GetParameter(0);
            duration = GetParameterAsFloat(1, 0);
            color = Tools.WebColor(GetParameter(2, "#000000"));
            if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: Fade({1}, {2}, {3})", new System.Object[] { DialogueDebug.Prefix, direction, duration, color }));

            if (duration > SmoothMoveCutoff) {

                // Create a 1x1 texture:
                Texture2D texture = new Texture2D (1, 1);
                texture.SetPixel(0, 0, color);
                texture.Apply();

                // Add a temporary object with a GUITexture component:
                fader = new GameObject("Fader");
                fader.transform.parent = gameObject.transform;
                fader.transform.position = new Vector3 (0.5f, 0.5f, 1000);
                faderGuiTexture = fader.AddComponent<GUITexture>();
                faderGuiTexture.texture = texture;

                // Set up duration:
                startTime = DialogueTime.time;
                endTime = startTime + duration;

                fadeIn = string.Equals(direction, "in", System.StringComparison.OrdinalIgnoreCase);

                if (fadeIn) {
                    faderGuiTexture.color = new Color(color.r, color.g, color.b, 1);
                } else {
                    faderGuiTexture.color = new Color(color.r, color.g, color.b, 0);
                }

            } else {
                Stop();
            }
        }
 /// <summary>
 /// Calls GetComponent for all cached components if the currently cached instance is no longer valid.
 /// </summary>
 public void ResetCacheDestroyed()
 {
     if (!animation)
     {
         animation = GetComponent<Animation>();
     }
     if (!audio)
     {
         audio = GetComponent<AudioSource>();
     }
     if (!camera)
     {
         camera = GetComponent<Camera>();
     }
     if (!collider)
     {
         collider = GetComponent<Collider>();
     }
     if (!collider2D)
     {
         collider2D = GetComponent<Collider2D>();
     }
     if (!constantForce)
     {
         constantForce = GetComponent<ConstantForce>();
     }
     if (!guiText)
     {
         guiText = GetComponent<GUIText>();
     }
     if (!guiTexture)
     {
         guiTexture = GetComponent<GUITexture>();
     }
     if (!hingeJoint)
     {
         hingeJoint = GetComponent<HingeJoint>();
     }
     if (!light)
     {
         light = GetComponent<Light>();
     }
     if (!networkView)
     {
         networkView = GetComponent<NetworkView>();
     }
     if (!particleEmitter)
     {
         particleEmitter = GetComponent<ParticleEmitter>();
     }
     if (!particleSystem)
     {
         particleSystem = GetComponent<ParticleSystem>();
     }
     if (!renderer)
     {
         renderer = GetComponent<Renderer>();
     }
     if (!rigidbody)
     {
         rigidbody = GetComponent<Rigidbody>();
     }
     if (!rigidbody2D)
     {
         rigidbody2D = GetComponent<Rigidbody2D>();
     }
     if (!transform)
     {
         transform = GetComponent<Transform>();
     }
 }
 /// <summary>
 /// Caches the current GUITexture attached to the object.
 /// </summary>
 public void ResetGUITextureCache()
 {
     guiTexture = GetComponent<GUITexture>();
 }
Example #24
0
		///<summary>
		///	Use this for initialization
		///</summary>
		override protected void Start () 
		{
			
			base.Start();


			//
			_clickGUIText 	= clickGUIText_gameobject.GetComponent<GUIText>();
			_logo_guitexture = logoGUITexture_gameobjects.GetComponent<GUITexture>();
			animationMonitor = GetComponent<AnimationMonitor>();

			//EXPERIMENT: STORE CLIPS IN CUSTOM PROPERTIES AND ADD THEM DYNAMICALLY
			//	NOT REQUIRED FOR THE CURRENT SETUP, BUT COULD BE USEFUL FOR DYNAMIC
			//	ANIMATION SETUP
			animation.AddClip (introStartAnimationClip, ANIMATION_NAME_INTRO_UI_START);
			animation.AddClip (introEndAnimationClip, ANIMATION_NAME_INTRO_UI_END);
			
			
			
		}
 // GetTouchzone
 internal void GetTouchzoneGUITexture( GameObject gameObject )
 {
     touchzoneGUITexture = gameObject.GetComponent<GUITexture>();
 }
        private void CreateFullScreenMovie()
        {
            GameObject movieOb = new GameObject ("Movie clip");
            movieOb.transform.position = Vector3.zero;
            movieOb.transform.position = new Vector2 (0.5f, 0.5f);

            guiTexture = movieOb.AddComponent<GUITexture>();
            guiTexture.enabled = false;
            guiTexture.texture = movieClip;
            guiTexture.enabled = true;

            KickStarter.sceneSettings.SetFullScreenMovie (movieClip);
        }
Example #27
0
        public static CommandDelegate AlphaBy(GUITexture texture, float offset, double duration, CommandEase ease = null)
        {
            CheckArgumentNonNull(texture, "texture");

            return ChangeBy(texture.ToAlphaRef(), offset, duration, ease);
        }
Example #28
0
        // JoystickSetup
        public void JoystickSetup()
        {
            Joystick = transform.FindChild( JoystickTextureGOName ).guiTexture;
            JoystickBackground = transform.FindChild( JoystickBackgroundGOName ).guiTexture;
            JoystickTouchZone = transform.FindChild( JoystickTouchZoneGOName ).guiTexture;

            Joystick.color = halfColor;
            JoystickBackground.color = halfColor;
            JoystickTouchZone.color = halfColor;
        }
Example #29
0
        public static CommandDelegate TintTo(GUITexture texture, Color endColour, double duration, CommandEase ease = null)
        {
            CheckArgumentNonNull(texture, "texture");

            return TintTo(texture.ToColorRef(), endColour, duration, ease);
        }
        private void Initialize() {
            ReInput.EditorRecompileEvent += OnEditorRecompile; // subscribe to recompile event so we can handle recompiling in the editor

            if(SystemInfo.deviceType == DeviceType.Handheld) allowMouseControl = false; // disable mouse control on touch devices

            gui = GetComponent<GUITexture>();
            if(gui.texture == null) {
                Debug.LogError("TouchJoystick object requires a valid texture!");
                gameObject.SetActive(false);
                return;
            }

            if(!enumeratedTouchJoysticks) {
                try {
                    // Collect all joysticks in the game, so we can relay finger latching messages 
                    TouchJoystickExample[] objs = (TouchJoystickExample[])GameObject.FindObjectsOfType(typeof(TouchJoystickExample));
                    joysticks = new List<TouchJoystickExample>(objs.Length);
                    foreach(TouchJoystickExample obj in objs) {
                        joysticks.Add(obj);
                    }
                    enumeratedTouchJoysticks = true;
                } catch(Exception exp) {
                    Debug.LogError("Error collecting TouchJoystick objects: " + exp.Message);
                    throw;
                }
            }

            origPixelInset = gui.pixelInset; // store the original pixel inset
            origTransformPosition = transform.position; // store the original transform position

            RefreshPosition();

            initialized = true;
        }
 private static void CheckTextureNonNull(GUITexture texture)
 {
     if (texture == null) {
     throw new ArgumentNullException("texture");
     }
 }
 /// <summary>
 /// Caches all of the current standard components attached to the object.
 /// </summary>
 public void ResetCache()
 {
     animation = GetComponent<Animation>();
     audio = GetComponent<AudioSource>();
     camera = GetComponent<Camera>();
     collider = GetComponent<Collider>();
     collider2D = GetComponent<Collider2D>();
     constantForce = GetComponent<ConstantForce>();
     guiText = GetComponent<GUIText>();
     guiTexture = GetComponent<GUITexture>();
     hingeJoint = GetComponent<HingeJoint>();
     light = GetComponent<Light>();
     networkView = GetComponent<NetworkView>();
     particleEmitter = GetComponent<ParticleEmitter>();
     particleSystem = GetComponent<ParticleSystem>();
     renderer = GetComponent<Renderer>();
     rigidbody = GetComponent<Rigidbody>();
     rigidbody2D = GetComponent<Rigidbody2D>();
     transform = GetComponent<Transform>();
 }
	/// <summary>
	/// Use this for initialization
	/// </summary>
	public void Start()
	{
		Transform reticule = gameObject.transform.Find("Reticule");
		if(reticule == null)
		{
			Debug.LogError("No \"Reticule\" game object found");
		}
		_reticuleTexture = reticule.gameObject.GetComponent<GUITexture>();
		_reticuleTexture.pixelInset = new Rect(Screen.width / 2, Screen.height / 2, 16, 16);

		_feelingTextureMap = new Dictionary<string, Texture2D>();
		_demandTextureMap = new Dictionary<string, Texture2D>();
		
		ConstructForceTexture();

		OCLogger.Fine(gameObject.name + " is started.");
	}
Example #34
0
				private GUITexture bombHUD;			// Heads up display of whether the player has a bomb or not.


				void Awake ()
				{
						// Setting up the reference.
						bombHUD = GameObject.Find ("ui_bombHUD").guiTexture;
				}
        public override float Run()
        {
            #if UNITY_WEBGL

            return 0f;

            #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8

            if (!isRunning && filePath != "")
            {
                isRunning = true;

                if (canSkip)
                {
                    Handheld.PlayFullScreenMovie (filePath, Color.black, FullScreenMovieControlMode.CancelOnInput);
                }
                else
                {
                    Handheld.PlayFullScreenMovie (filePath, Color.black, FullScreenMovieControlMode.Full);
                }
                return defaultPauseTime;
            }
            else
            {
                isRunning = false;
                return 0f;
            }

            #elif UNITY_5 || UNITY_PRO_LICENSE

            if (movieClip == null)
            {
                ACDebug.LogWarning ("Cannot play movie - no movie clip set!");
                return 0f;
            }
            if (movieClipType == MovieClipType.OnMaterial && material == null)
            {
                ACDebug.LogWarning ("Cannot play movie - no material has been assigned. A movie clip can only be played as a material's texture, so a material must be assigned.");
                return 0f;
            }
            if (includeAudio && sound == null)
            {
                ACDebug.LogWarning ("Cannot play movie audio - no Sound object has been assigned.");
            }

            if (!isRunning)
            {
                isRunning = true;
                guiTexture = null;

                KickStarter.playerInput.skipMovieKey = "";

                if (movieClipType == MovieClipType.FullScreen)
                {
                    CreateFullScreenMovie ();
                }
                else if (movieClipType == MovieClipType.OnMaterial)
                {
                    material.mainTexture = movieClip;
                }
                movieClip.Play ();

                if (includeAudio)
                {
                    sound.GetComponent <AudioSource>().clip = movieClip.audioClip;
                    sound.Play (false);
                }

                if (movieClipType == MovieClipType.FullScreen || willWait)
                {
                    if (canSkip && skipKey != "")
                    {
                        KickStarter.playerInput.skipMovieKey = skipKey;
                    }
                    return defaultPauseTime;
                }
                return 0f;
            }
            else
            {
                if (movieClip.isPlaying)
                {
                    if (!canSkip || KickStarter.playerInput.skipMovieKey != "")
                    {
                        return defaultPauseTime;
                    }
                }

                if (includeAudio)
                {
                    sound.Stop ();
                }
                movieClip.Stop ();
                KickStarter.playerInput.skipMovieKey = "";

                if (movieClipType == MovieClipType.FullScreen)
                {
                    EndFullScreenMovie ();
                }

                isRunning = false;
                return 0f;
            }
            #else
            ACDebug.LogWarning ("On non-mobile platforms, this Action is only available in Unity 5 or Unity Pro.");
            return 0f;
            #endif
        }
Example #36
0
 private void Awake()
 {
     guiTexture = this.GetComponent<GUITexture>();
 }
Example #37
0
 // Use this for initialization
 void Start()
 {
     GuiTexture = GetComponent<GUITexture>();
 }
Example #38
0
        public static CommandDelegate AlphaFrom(GUITexture texture, float startAlpha, double duration, CommandEase ease = null)
        {
            CheckArgumentNonNull(texture, "texture");

            return ChangeFrom(texture.ToAlphaRef(), startAlpha, duration, ease);
        }