// 메소드 public void FormationCardsGrid(eGameCardSize eState,eBelong user,eCardType type) { int num = CardFindsNumCom(); if (num > 1) { } }
// private void Start() //{ //시작시 모든 게임슬롯을 null로해서 아이콘 이미지를 비활성화 시킨다. //FormationCards(); //FormationCardsArc(); //TODO: 이벤트 메니저 확장을 위해서 설정함 만약 쓰지 않을 경우 삭제 // EventManager.Instance.AddListener(EVENT_TYPE.SLOTNUMBER, OnEvent); // } //계산식 전체 크기를 벗어나지 않는 메소드 public void FormationCards(eGameCardSize eState) { int num = CardFindsNum(); //cardInfo가 null이 아닌 숫자 //카드의 숫자를 넘겨 받습니다. float curWidth = maxRimited - fade - width; //value 는 길이 float widthEa = curWidth / num; //value 는 길이 float endPosition = (0.5f * maxRimited) - (width * 0.5f) - (fade * 0.5f); //마지막 카드의 배치좌표 //할당 너비보다 카드가 크다면 겹쳐져야 한다. if (widthEa <= width) { //첫카드의 배치좌표 float startPos = -1 * ((0.5f * maxRimited) - (width * 0.5f) - (fade * 0.5f)); float cha = width - widthEa; //전체좌표를 적용해야 된다. //하나의 카드의 중심좌표로 배치하는가? 즉 Anchor을 파악해야된다. for (int i = 0; i < num; i++) { //if() cardsLength[i].gameObject.transform.localPosition = new Vector3(startPos + (i * widthEa), 0, 0); cardsLength[i].CardSetSize(eState); } } else if (widthEa > width) { float startPos = 0 - 0.5f * (maxRimited); //카드 사이의 공간 float aSpace = curWidth / (num + 1) - num * width / (num + 1); //공간이 남는다면 공간의 여백을 더 추가 해 줘야 한다. for (int i = 0; i < num; i++) { cardsLength[i].gameObject.transform.localPosition = new Vector3(startPos + aSpace + width + (i * (width + aSpace)), 0, 0); cardsLength[i].CardSetSize(eState); } } }
public void CardSetSizeCenter(eGameCardSize eState) { float sm = 0.5f; switch (eState) { case eGameCardSize.BASE: gameObject.transform.localScale = new Vector3(1 * sm,1 * sm,1); break; case eGameCardSize.MINI: gameObject.transform.localScale = new Vector3(0.5f * sm,0.5f * sm,1); break; case eGameCardSize.EXPAND: gameObject.transform.localScale = new Vector3(1.5f * sm,1.5f * sm,1); break; } }
public void CardSetSize(eGameCardSize eState) { switch (eState) { case eGameCardSize.BASE: gameObject.transform.localScale = new Vector3(1,1,1); break; case eGameCardSize.MINI: gameObject.transform.localScale = new Vector3(0.5f,0.5f,1); break; case eGameCardSize.EXPAND: gameObject.transform.localScale = new Vector3(1.1f,1.1f,1f); break; } }
}//Method END //계산식 전체 크기를 벗어나지 않는 메소드 public void FormationCardsArcCom(eGameCardSize eState,eBelong user,eCardType type) { //카드의 숫자를 넘겨 받습니다. int num = CardFindsNumCom(); if (num > 1) { //value 는 길이 float curWidth = maxRimited - fade - width; //value 는 길이 float widthEa = curWidth / num; //마지막 카드의 배치좌표 float endPosition = 0.5f * (maxRimited - width - fade); //카드가 기울어질 최대각도 float maxRot = -10; //Sin의 한번 반복량 float rot = 180 / (num - 1); //기울기 량 float angle = (maxRot * 2) / (num - 1); //아크의 곡선량*y값의 비율 float amount = 70f; //할당 너비보다 카드가 크다면 겹쳐져야 한다. if (widthEa <= width) { //첫카드의 배치좌표 410 //전체 보정값이 필요함 (endPos - lastCard)/2 float startPos = -1 * (0.5f * (maxRimited - width - fade)); float cha = width - widthEa; float lastCardPos = startPos + ((num - 1) * widthEa); float startFull = startPos + (endPosition - lastCardPos) / 2; //전체좌표를 적용해야 된다. //하나의 카드의 중심좌표로 배치하는가? 즉 Anchor을 파악해야된다. for (int i = 0; i < num; i++) { float curAng = i * rot; //반대편 if (curAng > 90) { curAng = 180 - (i * rot); } Vector3 moveTarget = new Vector3(startFull + (i * widthEa),amount * Mathf.Sin(curAng * Mathf.Deg2Rad) * -1,0); //cardsLength[i].gameObject.transform.localPosition = new Vector3(startFull + (i * widthEa), amount * Mathf.Sin(curAng * Mathf.Deg2Rad) * -1, 0); float curAngle = maxRot - i * angle; //-20 ~ 20 Quaternion rotation = Quaternion.Euler(0,0,curAngle); cardsLength[i].gameObject.transform.localRotation = Quaternion.Euler(0,0,curAngle); cardsLength[i].CardSetSize(eState); cardsLength[i].eBelongState = eBelong.COM; cardsLength[i].eType = eCardType.SLOT; //TODO: 출발하는 위치 값을 여기서 설정해 주어야 한다. iTween.MoveTo(cardsLength[i].gameObject,iTween.Hash("islocal",true, "position",moveTarget, "oncompletetarget",cardsLength[i].gameObject, "time",0.5f, "easetype","easeOutQuart") ); } } else if (widthEa > width) { //공간이 많이 남을때 float startPos = 0 - 0.5f * (maxRimited); //카드 사이의 공간 float aSpace = curWidth / (num + 1) - num * width / (num + 1); //공간이 남는다면 공간의 여백을 더 추가 해 줘야 한다. for (int i = 0; i < num; i++) { //cardsLength[i].gameObject.transform.localPosition = new Vector3(startPos + aSpace + width + (i * (width + aSpace)), 0, 0); Vector3 moveTarget = new Vector3(startPos + aSpace + width + (i * (width + aSpace)),0,0); iTween.MoveTo(cardsLength[i].gameObject,iTween.Hash("islocal",true, "position",moveTarget, "oncompletetarget",cardsLength[i].gameObject, "time",0.5f, "easetype","easeOutQuart") ); } } } //IF END }