Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

narizgudo

Parte estranha no código de uma classe

Recommended Posts

Dem uma olhada no código abaixo.

 

Alguém sabe o quer quer dizer o código a partir de 'null[] = ' ?

 

Este código é uma das classes do jogo http://www.miniclip.com/games/pirates-of-t...-mans-chest/en/ descompilado.

 

Abraços.

 

class com.digitaloutlook.sos.Kraken extends MovieClip
{
	var bStop, bIsPauzed, aTentakles, nStartCount, nShowTentacleCount, mcAllTentakles, mcGameMain, removeMovieClip, sState, stop, play, gotoAndStop, gotoAndPlay, _xscale, _yscale;
	function Kraken()
	{
		super();
	} // End of the function
	function onLoad()
	{
		this.configUI();
	} // End of the function
	function configUI()
	{
		bStop = false;
		bIsPauzed = false;
		aTentakles = new Array();
		nStartCount = 10;
		nShowTentacleCount = nStartCount;
		for (var _loc2 = 0; _loc2 < 5; ++_loc2)
		{
			aTentakles.push(mcAllTentakles["mcTentakle" + _loc2]);
		} // end of for
	} // End of the function
	function krakenIsHere()
	{
		mcGameMain.krakenIsHere();
	} // End of the function
	function removeKraken()
	{
		mcGameMain.krakenIsGone();
		this.removeMovieClip();
	} // End of the function
	function startNewLevel()
	{
		mcGameMain.startNewLevel();
	} // End of the function
	null[] = bIsPauzed ? (function ()
	{
		if (sState == "show")
		{
			if (nShowTentacleCount <= 0)
			{
			} // end if
		} // end if
	}) : (if (sState != "show") goto 134, nShowTentacleCount--, if (nShowTentacleCount > 0) goto 134, nShowTentacleCount = nStartCount, var _loc2 = Math.floor(Math.random() * aTentakles.length), aTentakles[_loc2].goSlap = true, "onEnterFrame");
	function changeState(s)
	{
		sState = s;
		if (s != "stopslappin")
		{
			if (bIsPauzed)
			{
				bStop = false;
				this.gotoAndStop(sState);
			}
			else
			{
				bStop = false;
				this.gotoAndPlay(sState);
			} // end if
		} // end else if
	} // End of the function
	function setGameMain(_mstr)
	{
		mcGameMain = _mstr;
	} // End of the function
	function shrink(_targetsize)
	{
		var _loc2 = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Regular.easeInOut, _xscale, _targetsize, 3.000000E-001, true);
		var _loc3 = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Regular.easeInOut, _yscale, _targetsize, 3.000000E-001, true);
	} // End of the function
	function pauzeGame()
	{
		bIsPauzed = true;
	} // End of the function
	function resumeGame()
	{
		bIsPauzed = false;
	} // End of the function
} // End of Class

Compartilhar este post


Link para o post
Compartilhar em outros sites

É um condicional

 

Se o array null[] = bIsPauzed se for igual a (function() la da vida

Então faz : (if (sState != "show");

 

 

É um tipo de condicional...

 

Da uma procurada no help do flash por ?: e você vai entender melhor

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

Hehehe

 

Sim, condição ternária...

conheco essa encrenca, mas digo no null[]

 

como null pode ser um array?

 

outra coisa, se você olhar bem, um método é definido por essa condição, esse método é anonimo? como é chamado durante a execução?

 

(liga voz do tio do jack chan)mais uma coisa(desliga voz), existem alguns 'goto ###' em uma das funções na condição, mas no flash não tem nenhum contrutor de linguagem chamado goto (eu acho)

 

mas vlw pela intenção

 

abraços.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom eu não faço ideia de como o camarada fez isso...

Mas que aquele null ali é uma array seguindo de um = com condicional é rs....

Agora o que ele faz? faço nem ideia

Esses goto é uma classe que ele criou provavelmente...

Eu sei que da pra aplicar sobre as proprias intancias e variaveis internas do flash outras aplicações... mas eu normalmente evito...

Esse maluco ai deve ter inventado um jeito de programar dele :)

Por isso desse código aparentemente sem pé nem cabeça rs

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.