/// <summary> /// 新建卡组按钮点击事件 /// </summary> public void NewCardGroupButtonClick() { UserData userData = gameManager.GetUserData(); UserCardGroup newCardGroup = userData.AddNewCardGroup(); AddCardGroupItemToScrollView(newCardGroup); }
void Start() { gameManager = GameManager.GetSingleInstance(); UserData userData = gameManager.GetUserData(); ResetAllCard(); currentCardGroupName = gameManager.GetCardGroupNameForCardGroupEditScene(); cardGroupNameInputField.text = currentCardGroupName; cardGroupNameInputField.onEndEdit.AddListener((value) => { ChangeCardGroupName(value); }); cardGroup = userData.GetCardGroupByName(currentCardGroupName); if (cardGroup == null) { Debug.LogError("卡组:" + currentCardGroupName + "不存在!"); gameManager.ReturnLastScene(); return; } ResetMainCardGroup(); ResetExtraCardGroup(); ResetDeputyCardGroup(); cardImage = GameObject.Find("CardImage").GetComponent <Image>(); cardNoText = GameObject.Find("CardNoText").GetComponent <Text>(); mainPanelTransform.gameObject.GetComponent <DropToPanelScript>().AddDropHandler(OnDropToMainPanel); extraPanelTransform.gameObject.GetComponent <DropToPanelScript>().AddDropHandler(OnDropToExtraPanel); deputyPanelTransform.gameObject.GetComponent <DropToPanelScript>().AddDropHandler(OnDropToDeputyPanel); CheckCardGroupLegal(); }
void AddCardGroupItemToScrollView(UserCardGroup userCardGroup) { GameObject gameObject = Instantiate(cardGroupItemPrefab, cardGroupScrollViewTransform); CardCroupItemScript cardCroupItemScript = gameObject.GetComponent <CardCroupItemScript>(); cardCroupItemScript.InitInfo(userCardGroup.cardGroupName, null, this); }
/// <summary> /// 设置卡组 /// </summary> /// <param name="selectCardGroup"></param> public virtual void SetCardGroup() { if (duelCardGroup != null) { return; } duelCardGroup = new DuelCardGroup(); UserCardGroup selectCardGroup = GameManager.GetSingleInstance().GetUserData().GetCardGroupByName(cardGroupName); foreach (var item in selectCardGroup.mainCardList) { for (int i = 0; i < item.number; i++) { duelCardGroup.AddCard(item.cardNo); } } ShuffleCardGroup(); opponentPlayer.SetCardGroupNotify(duelCardGroup); iamReady = true; duelScene.CheckPlayInit(); }