덱 정보 수정용 시스템 작성 완료
This commit is contained in:
parent
a00ff2e8f5
commit
e2106dd216
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,71 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeckPrefab : MonoBehaviour
|
||||
{
|
||||
[SerializeField] int index;
|
||||
[SerializeField] Image img;
|
||||
|
||||
public int GetIndex { get { return index; } }
|
||||
|
||||
long unitId;
|
||||
|
||||
public long GetUnitId { get { return unitId; } }
|
||||
|
||||
public void UnitSet()
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
unitId = Statics.deck_info[0].deck_unit0_id;
|
||||
break;
|
||||
case 1:
|
||||
unitId = Statics.deck_info[0].deck_unit1_id;
|
||||
break;
|
||||
case 2:
|
||||
unitId = Statics.deck_info[0].deck_unit2_id;
|
||||
break;
|
||||
case 3:
|
||||
unitId = Statics.deck_info[0].deck_unit3_id;
|
||||
break;
|
||||
case 4:
|
||||
unitId = Statics.deck_info[0].deck_unit4_id;
|
||||
break;
|
||||
case 5:
|
||||
unitId = Statics.deck_info[0].deck_unit5_id;
|
||||
break;
|
||||
case 6:
|
||||
unitId = Statics.deck_info[0].deck_unit6_id;
|
||||
break;
|
||||
case 7:
|
||||
unitId = Statics.deck_info[0].deck_unit7_id;
|
||||
break;
|
||||
case 8:
|
||||
unitId = Statics.deck_info[0].deck_unit8_id;
|
||||
break;
|
||||
default:
|
||||
Debug.LogError("Not Date");
|
||||
return;
|
||||
}
|
||||
UnitChange(unitId);
|
||||
}
|
||||
|
||||
public void UnitChange(long unit_id)
|
||||
{
|
||||
this.unitId = unit_id;
|
||||
if (unit_id == 0)
|
||||
{
|
||||
img.color = new Color(1, 1, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
img.sprite = Statics.longUnits[Statics.deckUnit[unit_id].unit_id].GetComponent<UnitCtrl>().unitSprite;
|
||||
img.color = Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
public void UnitButton()
|
||||
{
|
||||
UnitChange(UnitSetUiCtrl.Instance.DeckSwap(index, unitId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1351b780cbbdf6f429f568c8da48cb70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -44,15 +44,15 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
|||
isEndGame = false;
|
||||
delay = 0.0f;
|
||||
units = new UnitCtrl[9];
|
||||
units[0] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit0_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[1] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit1_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[2] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit2_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[3] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit3_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[4] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit4_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[5] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit5_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[6] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit6_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[7] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit7_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[8] = Statics.intUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit8_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[0] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit0_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[1] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit1_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[2] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit2_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[3] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit3_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[4] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit4_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[5] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit5_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[6] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit6_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[7] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit7_id].unit_id].GetComponent<UnitCtrl>();
|
||||
units[8] = Statics.longUnits[Statics.deckUnit[Statics.deck_info[0].deck_unit8_id].unit_id].GetComponent<UnitCtrl>();
|
||||
for (int n = 0; n < unitSpriteButton.Length; n++)
|
||||
{
|
||||
unitSpriteButton[n].sprite = units[n].unitSprite;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class GameManager : DontDestroy<GameManager>
|
|||
{
|
||||
obj.GetComponent<UnitCtrl>().DataSet(data.Key);
|
||||
Statics.stringUnits.Add(data.Value.name, obj);
|
||||
Statics.intUnits.Add(data.Value.index, obj);
|
||||
Statics.longUnits.Add(data.Value.index, obj);
|
||||
}
|
||||
}
|
||||
//stringIcons
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ public class DeckUnitInfo
|
|||
{
|
||||
public long id { get; set; }
|
||||
public long unit_id { get; set; }
|
||||
public long user_id { get; set; }
|
||||
public long equip0_id { get; set; }
|
||||
public long equip1_id { get; set; }
|
||||
public long equip2_id { get; set; }
|
||||
|
|
@ -97,7 +96,6 @@ public class DeckUnitInfo
|
|||
public class Equipment
|
||||
{
|
||||
public long id { get; set; }
|
||||
public long user_id { get; set; }
|
||||
public long equip_unit { get; set; }
|
||||
public int rand_stats { get; set; }
|
||||
public long equipment_data_id { get; set; }
|
||||
|
|
@ -106,7 +104,6 @@ public class Equipment
|
|||
public class DeckInfo
|
||||
{
|
||||
public long id { get; set; }
|
||||
public long user_id { get; set; }
|
||||
public int deck_type { get; set; }
|
||||
public long deck_unit0_id { get; set; }
|
||||
public long deck_unit1_id { get; set; }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ using UnityEngine.UI;
|
|||
public class Statics
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
public static readonly string url = "https://127.0.0.1:4860";
|
||||
//public static readonly string url = "https://127.0.0.1:4860";
|
||||
public static readonly string url = "https://game.pandoli365.com";
|
||||
#else
|
||||
public static readonly string url = "https://game.pandoli365.com";
|
||||
#endif
|
||||
|
|
@ -17,7 +18,7 @@ public class Statics
|
|||
public static ExcelDatas excelDatas;
|
||||
|
||||
public static Dictionary <string, GameObject> stringUnits = new Dictionary<string,GameObject>();
|
||||
public static Dictionary <long, GameObject> intUnits = new Dictionary<long, GameObject>();
|
||||
public static Dictionary <long, GameObject> longUnits = new Dictionary<long, GameObject>();
|
||||
|
||||
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,4 +25,6 @@ public class UnitPrefab : MonoBehaviour
|
|||
{
|
||||
UnitSetUiCtrl.Instance.StatusSet(this, unitData, deckUnitInfo, unitCtrl);
|
||||
}
|
||||
|
||||
public long GetUnitId { get { return deckUnitInfo.id; } }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
|
||||
//케릭터 카메라
|
||||
[SerializeField] Transform CamContent;
|
||||
[SerializeField] GameObject UnitObject;
|
||||
GameObject UnitObject;
|
||||
|
||||
//아이템 정보
|
||||
[SerializeField] GameObject itemInfo;
|
||||
|
|
@ -70,6 +70,9 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
DeckUnitInfo selectUnit;
|
||||
UnitPrefab selectUnitPrefab;
|
||||
|
||||
//덱 유닛들
|
||||
[SerializeField] DeckPrefab[] DeckPrefabs;
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
maxLevel.text = Statics.dynamic["maxLevel"];
|
||||
|
|
@ -89,6 +92,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
var clone = obj.GetComponent<UnitPrefab>();
|
||||
return clone;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
|
|
@ -114,6 +118,11 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
onUnitPrefabList.Add(prefab);
|
||||
}
|
||||
onUnitPrefabList[0].SelectUnit();
|
||||
|
||||
for(int n = 0; n < DeckPrefabs.Length; n++)
|
||||
{
|
||||
DeckPrefabs[n].UnitSet();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
|
|
@ -154,7 +163,7 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
objDeck.SetActive(true);
|
||||
itemInfo.SetActive(false);
|
||||
}
|
||||
public void ButtoncHaracteristic()
|
||||
public void ButtonHaracteristic()
|
||||
{
|
||||
objInfo.SetActive(false);
|
||||
objItemView.SetActive(false);
|
||||
|
|
@ -528,4 +537,30 @@ public class UnitSetUiCtrl : SingletonMonoBehaviour<UnitSetUiCtrl>
|
|||
}, selectUnit.id, selectItem.id, selectItem.equip_unit == 0);
|
||||
}
|
||||
|
||||
public long DeckSwap(int index, long unit_id)
|
||||
{
|
||||
long selectUnitId = selectUnitPrefab.GetUnitId;
|
||||
for (int n = 0; n < DeckPrefabs.Length; n++)
|
||||
{
|
||||
if (DeckPrefabs[n].GetIndex == index)
|
||||
continue;
|
||||
if (DeckPrefabs[n].GetUnitId == selectUnitId)//유닛정보가 들어와야함
|
||||
{
|
||||
DeckPrefabs[n].UnitChange(unit_id);
|
||||
}
|
||||
}
|
||||
return selectUnitId;
|
||||
}
|
||||
|
||||
public void DeckSaveButton()
|
||||
{
|
||||
//네트워크 통신 필요
|
||||
}
|
||||
public void DeckResetButton()
|
||||
{
|
||||
for (int n = 0; n < DeckPrefabs.Length; n++)
|
||||
{
|
||||
DeckPrefabs[n].UnitSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue