コード例 #1
0
ファイル: CDropManager.cs プロジェクト: chamto/pudPractice
		public void Init()
		{

			const uint MAX_DROP_COLUMN = 6;
			const uint MAX_DROP5X6 = 5 * 6;
			const uint MAX_DROP5X6X2 = 5 * 6 * 2;
			const byte MAX_DROPKIND = 6;
			eResKind[] dropKind = new  eResKind[MAX_DROPKIND];
			dropKind[0] = eResKind.Red;
			dropKind[1] = eResKind.Green;
			dropKind[2] = eResKind.Blue;
			dropKind[3] = eResKind.Light;
			dropKind[4] = eResKind.Dark;
			dropKind[5] = eResKind.Heart;

			System.Random rndDrop = new System.Random();

			Vector3 pos = Vector3.zero;
			MonoDrop pDrop = null;
			Index2 ixy = Index2.Zero;
			for(int i=0 ; i<MAX_DROP5X6X2 ; i++)
			{
				ixy.ix = (int)(i% MAX_DROP_COLUMN); 
				ixy.iy = (int)(i/MAX_DROP_COLUMN); 
				pos.x = ixy.ix * m_boardInfo.squareWidth;
				pos.y = ixy.iy * m_boardInfo.squareHeight;
				pDrop = MonoDrop.Create(Single.UIRoot.transform, 
				                        dropKind[rndDrop.Next(0,MAX_DROPKIND)],
				                        pos);
				pDrop.SetIndex(ixy);
				m_mapDrop.Add(pDrop.id, pDrop);


				//------ setting drop of color that invisialbe 30~  ------------
				pDrop.SetColor(Color.gray); //chamto test
				if(null != pDrop && i >= MAX_DROP5X6)
				{
					pDrop.SetColor(Color.blue);
					pDrop.GetBoxCollider2D().enabled = false; //20150212 chamto - 터치입력을 못받게 충돌체를 비활성 시켜 놓는다.
				}

			}

			//20150406 chamto - bug1-1 reproduction : The removal of non-union drop : at func LineInspection 
			//m_mapDrop.GetMonoDropByIndex2 (new Index2 (4, 5)).setDropKind = eResKind.Dark;
			//m_mapDrop.GetMonoDropByIndex2 (new Index2 (4, 4)).setDropKind = eResKind.Dark;
			//m_mapDrop.GetMonoDropByIndex2 (new Index2 (4, 3)).setDropKind = eResKind.Dark;
			//m_mapDrop.GetMonoDropByIndex2 (new Index2 (4, 2)).setDropKind = eResKind.Dark;

			//20150403 chamto test
			DebugMap_Init (); 
			Update_DebugMap ();
		
		}
コード例 #2
0
ファイル: CDropManager.cs プロジェクト: chamto/pudPractice
		//------------------------------------------------------------------------
		// basic method
		//------------------------------------------------------------------------

		public MonoDrop AddDropInBoard(Index2 placePos , eResKind eDropKind)
		{
			return null;
		}
コード例 #3
0
ファイル: CResoureManager.cs プロジェクト: chamto/pudPractice
		public Sprite LoadSprites(eResKind in_eKey , ushort index)
		{

			if (eResKind.None == in_eKey)
								return null;

			SResInfo info;
			if(m_dictTextureInfo.TryGetValue((ushort)in_eKey,out info) )
			{
				//CDefine.DebugLog(info.GetFullPath() + "------------"); //chamto test
				//return Resources.Load<Sprite>(info.GetFullPath());

				Sprite[] sp = Resources.LoadAll<Sprite>(info.GetFullPath());
				if(0 < sp.Length && index <= sp.Length) 
					return sp[index];

			}

			CDefine.DebugLogWarning("Failed LoadSprite");
			return null;
		}
コード例 #4
0
ファイル: CResoureManager.cs プロジェクト: chamto/pudPractice
		public bool TryGetTextureInfo(eResKind in_eKey , out SResInfo out_info)
		{
			return m_dictTextureInfo.TryGetValue((ushort)in_eKey,out out_info);
		}
コード例 #5
0
ファイル: CResoureManager.cs プロジェクト: chamto/pudPractice
		public string GetFileName(eResKind eKey)
		{
			SResInfo info;
			m_dictTextureInfo.TryGetValue((ushort)eKey,out info);
			return info.strFileName;
		}
コード例 #6
0
ファイル: MonoDrop.cs プロジェクト: chamto/pudPractice
	static public MonoDrop Create(Transform parent , eResKind eDrop , Vector3 localPos)
	{
		GameObject newObj = CResoureManager.CreatePrefab(SResDefine.pfDROPINFO);
		if(null == newObj) 
		{
			CDefine.DebugLogError(string.Format("Failed to create Prefab : " + SResDefine.pfDROPINFO));
			return null;
		}
		MonoDrop drop = newObj.GetComponent<MonoDrop>();
		if(null == drop) 
		{
			CDefine.DebugLogError(string.Format("MonoDrop is null"));
			return null;
		}
		

		//-------------------------------------------------

		//drop.dropInfo = DropInfo.Create ();
		drop.id = Single.ResMgr.GetSequenceId ();
		//drop.SetIndex(Single.DropMgr.boardInfo.GetPositionToIndex2D (localPos));
		drop.index2D = Single.DropMgr.boardInfo.GetPositionToIndex2D (localPos);
		drop.setDropKind = eDrop;

		//Specify the parent object
		drop.transform.parent = parent;
		drop.name = "drop" + drop.id;
		
		//newObj.transform.position = new Vector3(relativeCoord_x,relativeCoord_y,0); //[주의!!] 부모에 대한 상대좌표를 지정해야 하기 때문에 localposition 을 써야 한다.  
		drop.transform.localPosition = localPos;
		
		
		//todo modify that localposition
		drop.gotoLocalPosition = localPos;

		//20150331 chamto test
		//drop.testIndex2.ix = drop.index2D.ix;
		//drop.testIndex2.iy = drop.index2D.iy;
		drop.m_textMesh_Index2 = MonoDrop.Add3DText (drop.transform, drop.index2D.ToString (), Color.white, new Vector3(-0.5f,0,-2f));
		//Index2 localIdx = Single.DropMgr.Board.GetPositionToIndex2D (drop.gotoLocalPosition);
		//drop.m_textMesh_LocalIdx = MonoDrop.Add3DText (drop.transform, localIdx.ToString(), Color.red, new Vector3(-0.5f,-0.3f,-2f));

		
		return drop;
	}