Example #1
0
        //添加一个生物实例展示
        public void AchieveOneMinion(CardEntry minionCellItem, HexGridItem hexGridItem, MinionGridMediator minionGridMediator)
        {
            Vector3        position           = new Vector3();
            HexCoordinates showHexCoordinates = HexCoordinates.ReverseFromOffsetCoordinates(minionCellItem.nowIndex.X, minionCellItem.nowIndex.Z, hexGridItem.modelInfo.arrayMode);

            position   = MinionMetrics.erectPosition(position, showHexCoordinates.X, showHexCoordinates.Z, hexGridItem.modelInfo.arrayMode);
            position.y = 1f;
            //创建一个生物实例
            MinionCellView cell = minionCellPool.Pop();

            cell.transform.SetParent(transform, false);
            cell.transform.localPosition = position;
            cell.minionCellItem          = minionCellItem;
            cell.playerCode = minionGridMediator.playerCode;
            TextMeshProUGUI atkAndDef = UtilityHelper.FindChild <TextMeshProUGUI>(cell.transform, "MinionCellLabel");

            atkAndDef.text = minionCellItem.atk.ToString() + "-" + minionCellItem.def.ToString();
            //添加绑定信息
            cell.OnPointerEnter = () =>
            {
                minionGridMediator.SendNotification(
                    UIViewSystemEvent.UI_VIEW_CURRENT,
                    cell,
                    StringUtil.GetNTByNotificationTypeAndUIViewNameAndOtherTypeAndDelayedProcess(
                        UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW,
                        UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo),
                        "MinionCellView",
                        "N"
                        )
                    );
            };
            cell.OnPointerExit = () =>
            {
                minionGridMediator.SendNotification(
                    UIViewSystemEvent.UI_VIEW_CURRENT,
                    UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo),
                    StringUtil.GetNTByNotificationTypeAndDelayedProcess(
                        UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW,
                        "N"
                        )
                    );
            };
            cell.OnPointerDown = (CardEntry downMinionCellItem) =>
            {
                minionGridMediator.SendNotification(
                    OperateSystemEvent.OPERATE_SYS,
                    downMinionCellItem,
                    OperateSystemEvent.OPERATE_SYS_POINTER_DOWN_ONE_MINION
                    );
            };
            cell.OnPointerUp = (CardEntry upMinionCellItem) =>
            {
            };
            minionCellViews.Add(minionCellItem.nowIndex, cell);
            MinionCellMaterialChange(cell, minionCellItem);
            UtilityLog.Log("生成一个生物:" + minionCellItem.cardInfo.name, LogUtType.Operate);
        }
Example #2
0
 //初始化
 public void AchieveMinionGrid(MinionGridItem minionGridItem, HexGridItem hexGridItem, MinionGridMediator minionGridMediator)
 {
     Dictionary <HexCoordinates, CardEntry> .KeyCollection keyCol = minionGridItem.minionCells.Keys;
     foreach (HexCoordinates key in keyCol)
     {
         CardEntry minionCellItem = minionGridItem.minionCells[key];
         AchieveOneMinion(minionCellItem, hexGridItem, minionGridMediator);
     }
     //渲染需要放在格子生成完毕后
     //minionMesh.Triangulate(minionCellViews, hexGridItem.modelInfo.arrayMode);
 }