Esempio n. 1
0
    static public bool getMinimapIconInfo(int nIconID, ref SMinimapIcon data)
    {
        IntPtr ptr = _getMinimapIconInfo(nIconID);

        if ((int)ptr == 0)
        {
            return(false);
        }

        data = IntPtrHelper.toData <SMinimapIcon>(ptr);
        return(true);
    }
Esempio n. 2
0
    // 小地图添加物体
    public void AddObject(int nObjID, int nIconID, int nCamp, int nSight, byte entityType, int nRelation, int data)
    {
        // 此处优化下,因为已知MinimapIcon.csv中没有0的这个id. 图标0是野怪
        if (nIconID == 0)
        {
            //Trace.Log("minimap addobject =" + nObjID + " failed, nIconID==0");
            return;
        }

        SMinimapIcon sIconInfo = new SMinimapIcon();

        if (GameLogicAPI.getMinimapIconInfo(nIconID, ref sIconInfo) == false)
        {
            Trace.Log("minimap AddObject!!!!!!!!, GameLogicAPI.getMinimapIconInfo nIconID=" + nIconID);
            return;
        }
        // 阵营显示中敌方实体不在小地图上显示,不创建
        if (sIconInfo.nShowType == 0 && nRelation == 1)
        {
            Trace.Log("not show " + nObjID);
            return;
        }

        String strFg = null;
        String strBg = null;

        if (nRelation == 0)
        {
            strFg = sIconInfo.szFriendCampFg;
            strBg = sIconInfo.szFriendCampBg;
        }
        else if (nRelation == 1)
        {
            strFg = sIconInfo.szEnemyCampFg;
            strBg = sIconInfo.szEnemyCampBg;
        }
        else if (nRelation == 2)
        {
            strFg = sIconInfo.szMidCampFg;
            strBg = sIconInfo.szMidCampBg;
        }
        else if (nRelation == 3)
        {
            strFg        = sIconInfo.szMainHeroFg;
            strBg        = sIconInfo.szMainHeroBg;
            mainHeroCamp = nCamp;
        }
        else
        {
            Trace.LogError("minimap AddObject, no defined nRelation=" + nRelation);
            return;
        }

        int nIsPlayer = ((ENTITY_TYPE)entityType == ENTITY_TYPE.TYPE_PLAYER_ROLE) ? 1 : 0;

        bool canDrawHP = true;

        // 普通怪物不用绘制血量
        if ((ENTITY_TYPE)entityType == ENTITY_TYPE.TYPE_MONSTER && data != (int)EWarMonsterExec.EWME_Tower && data != (int)EWarMonsterExec.EWME_Base)
        {
            canDrawHP = false;
        }

        MyInvokeQ._Invoke("OnCreateEntity", nObjID, strBg, strFg, nSight, nCamp, nIsPlayer, nRelation, canDrawHP);

        // 根据主角阵营小地图自动选择到默认位置
        if (nRelation == 3)
        {
            // 尝试旋转小地图
            if (this.mMapID != -1)
            {
                int nDefalutAngel, nXOffset, nYOffset = 0;
                GetDefaultRotateInfo(mainHeroCamp, out nDefalutAngel, out nXOffset, out nYOffset);
                MyInvokeQ._Invoke("RotateMinimap", nDefalutAngel, nXOffset, nYOffset);
            }
        }
    }