Пример #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);
        }
Пример #2
0
        //确定顶点
        void Triangulate(MinionCellView cell, string arrayMode)
        {
            Vector3 center = cell.transform.localPosition;

            Vector3[] arrayCorners = MinionMetrics.getCornersByArrayMode(arrayMode);
            for (int i = 0; i < 6; i++)
            {
                AddTriangle(
                    center,
                    center + arrayCorners[i],
                    center + arrayCorners[i + 1]
                    );
                AddTriangleColor(Color.green);
            }
        }