Example #1
0
//	IEnumerator StageLoading(  )
//	{
//		// Custom Update Routine which repeats forever
//		do
//		{
//			// wait one frame and continue
//			yield return 0;
//					
//			if ( bIsReady == true )
//			{
//				Debug.Log( "LoadingCoroutine End"  + Time.time );
//				// end
//				PanelManager.Instance.CloseUI( "Panel_Loading");
//				yield break;
//			}		
//		} while (true);
//
//	}


	// Use this for initialization
	void Start () {

		long tick = System.DateTime.Now.Ticks;

		System.GC.Collect();			// Free memory resource here

		// create pool
		CreateAllDataPool();

		Debug.Log( "stage srart loding"  );

		// loading panel
	//	PanelManager.Instance.OpenUI( "Panel_Loading");
		bIsLoading = true;
	//	StartCoroutine("StageLoading" );

		// clear data
		Clear ();
		
		Debug.Log( "stageloding:clearall"  );		
		// load const data
		StageData = ConstDataManager.Instance.GetRow<STAGE_DATA> ( GameDataManager.Instance.nStageID );
		if( StageData == null ){
			Debug.LogFormat( "stageloding:StageData fail with ID {0}  "  , GameDataManager.Instance.nStageID );
			return;
		}
		
		// load scene file
		if( LoadScene( StageData.n_SCENE_ID ) == false ){
			Debug.LogFormat( "stageloding:LoadScene fail with ID {0} "   , StageData.n_SCENE_ID );
			return;
		}
		
		// EVENT 
		//GameDataManager.Instance.nRound = 0;		// many mob pop in talk ui. we need a 0 round to avoid issue
		
		//Record All Event to execute
		//EvtPool.Clear();
		char [] split = { ';' };
		string [] strEvent = StageData.s_EVENT.Split( split );
		for( int i = 0 ; i< strEvent.Length ; i++ )
		{
			int nEventID = int.Parse( strEvent[i] );
			STAGE_EVENT evt = ConstDataManager.Instance.GetRow<STAGE_EVENT> ( nEventID );
			if( evt != null ){
				EvtPool.Add( nEventID , evt );
			}
		}
		
		Debug.Log( "stageloding:create event Pool complete"   );

//		// clear data
//		Clear ();
//
//		// load const data
//		StageData = ConstDataManager.Instance.GetRow<STAGE_DATA> ( GameDataManager.Instance.nStageID );
//		if( StageData == null )
//			return ;
//		
//		// load scene file
//		if( LoadScene( StageData.n_SCENE_ID ) == false )
//			return ;
//		
//		// EVENT 
//		//GameDataManager.Instance.nRound = 0;		// many mob pop in talk ui. we need a 0 round to avoid issue
//
//		//Record All Event to execute
//		//EvtPool.Clear();
//		char [] split = { ';' };
//		string [] strEvent = StageData.s_EVENT.Split( split );
//		for( int i = 0 ; i< strEvent.Length ; i++ )
//		{
//			int nEventID = int.Parse( strEvent[i] );
//			STAGE_EVENT evt = ConstDataManager.Instance.GetRow<STAGE_EVENT> ( nEventID );
//			if( evt != null ){
//				EvtPool.Add( nEventID , evt );
//			}
//		}
		

		// regedit game event
		RegeditGameEvent( true );	
		// create sub panel?

		Panel_CMDUnitUI.OpenCMDUI( _CMD_TYPE._SYS , 0 );
		PanelManager.Instance.OpenUI( Panel_UnitInfo.Name );
		PanelManager.Instance.OpenUI( Panel_MiniUnitInfo.Name );

		//Dictionary< int , STAGE_EVENT > EvtPool;			// add event id 
		bIsLoading = false;	

		long during = System.DateTime.Now.Ticks-tick;
		Debug.Log( "stage srart loding complete. total ticket:"  + during );


	}
Example #2
0
	Dictionary< int , Panel_unit > IdentToUnit;			// allyPool
	//Dictionary< int , UNIT_DATA > UnitDataPool;			// ConstData pool


	// ScreenRatio
	// float fUIRatio;
	public void CreateAllDataPool()
	{

		StageData = new STAGE_DATA();
		//event

		EvtPool = new Dictionary< int , STAGE_EVENT >();			// add event id 

		WaitPool = new List< STAGE_EVENT >();					// check ok. waitinf to execute event
		//EvtCompletePool = new Dictionary< int , int >();
		
		// unit
		IdentToUnit = new Dictionary< int , Panel_unit >();		//
		
		
		OverCellPool 	= new Dictionary< string , GameObject >();			// Over tile effect pool ( in = cell key )
		OverCellAtkPool = new Dictionary< string , GameObject >();					
		OverCellPathPool= new Dictionary< string , GameObject >();

		OverCellAOEPool= new Dictionary< string , GameObject >();


		//List < iVec2 >
		UnitPanelObj.CreatePool( st_CellObjPoolSize / 2 );

		MoveEftObj.CreatePool( st_CellObjPoolSize );
		AtkEftObj.CreatePool( st_CellObjPoolSize );
		AoeEftObj.CreatePool( st_CellObjPoolSize /4 );

		ValueEftObj.CreatePool( st_CellObjPoolSize / 10  );
	}