Пример #1
0
        public void get_value(string id, Action onfin)
        {
            this.resolve(id);
            bool flag = !this.m_map.ContainsKey(id);

            if (flag)
            {
                GameTools.PrintCrash("map grd file load err!");
                onfin();
            }
            else
            {
                List <string> l = this.m_map[id];
                Action < > 9__1;
                this.dataGrd(l[0], delegate
                {
                    ClientGrdConfig arg_32_0 = this;
                    string arg_32_1          = l[1];
                    Action arg_32_2;
                    if ((arg_32_2 = < > 9__1) == null)
                    {
                        arg_32_2 = (< > 9__1 = delegate
                        {
                            onfin();
                        });
                    }
                    arg_32_0.dataHdt(arg_32_1, arg_32_2);
                });
Пример #2
0
        //========

        //private int hdtindex;
        //override public double getZ( double x, double y)
        //{
        //	//return 0;
        //	byte[] gray = (this.g_gameConfM as muCLientConfig).localGrd.gray;
        //	float width = (this.g_gameConfM as muCLientConfig).localGrd.wight;
        //	float height = (this.g_gameConfM as muCLientConfig).localGrd.height;
        //	double posy = 0;
        //	if (gray!=null)
        //	{
        //		int index = (int)((y * GameConstant.PIXEL_TRANS_UNIT) * width) + (int)(x * GameConstant.PIXEL_TRANS_UNIT);
        //		if (Math.Abs(index) < gray.Length)
        //		{
        //			hdtindex = gray[(int)((y * GameConstant.PIXEL_TRANS_UNIT) * width) + (int)(x * GameConstant.PIXEL_TRANS_UNIT)];
        //			posy = (hdtindex - GameConstant.MIN_GRAY) * GameConstant.GRAY_TRANS_PIXEL;
        //			if (posy <= 0.5)
        //			{
        //				posy = 0;
        //			}
        //			return posy;
        //		}
        //	}
        //	return posy;

        //	/*
        //	Variant pinfo = this._netM.joinWorldInfoInst.mainPlayerInfo;
        //	uint currMapid = pinfo["mapid"];
        //	todo map conf
        //	Variant local_conf = this.mgr._sceneM.GraphMgr.getMapConf( currMapid.ToString() );
        //	Variant conf =  this._gameConfM.svrMapsConf.getSingleMapConf( currMapid );
        //	float tile_size = conf["tile_size"];
        //	float globaMapW = conf["width"] * tile_size;
        //	float globaMapH = conf["height"] * tile_size;*/
        //}


        override public float getZ(float x, float y)
        {
            return(ScenceUtils.getGroundHight(x, y));

            return(0);

            ClientGrdConfig cgc = (this.g_gameConfM as muCLientConfig).localGrd;

            if (cgc.m_hdtdata != null)
            {
                //debug.Log("getZ x = " + x* GameConstantDef.PIXEL_TRANS_HDTP + "   y = " + y* GameConstantDef.PIXEL_TRANS_HDTP); 以前的高度图是阻挡格的9倍,相当一个阻挡3*3个高度
                uint msk_x = (uint)(x * 0.03125f);
                uint msk_y = (uint)(y * 0.03125f);

                uint idx = msk_y * lgmap.m_unMapWidth + msk_x;

                //debug.Log("getZ x = " + msk_x + "   y = " + msk_y + "   map w =" + lgmap.m_unMapWidth);

                if (idx < cgc.m_hdtdata.Length)
                {
                    return(cgc.m_hdtdata[idx]);
                }
            }

            //jason 先用统一高度
            float fhdt_z = (this.g_gameConfM as muCLientConfig).localGrd.m_hdt_z;

            return(fhdt_z);

            //这里需要处理下差值


            //byte[] gray = (this.g_gameConfM as muCLientConfig).localGrd.gray;
            //float width = (this.g_gameConfM as muCLientConfig).localGrd.grayWidth;
            //float height = (this.g_gameConfM as muCLientConfig).localGrd.grayHeight;

            ////todo
            //float hmin = (this.g_gameConfM as muCLientConfig).localGrd.min * 0.01f;
            //float hmax = (this.g_gameConfM as muCLientConfig).localGrd.max * 0.01f;

            //int hdt = gethdt((int)(x * GameConstantDef.PIXEL_TRANS_HDTP), (int)(y* GameConstantDef.PIXEL_TRANS_HDTP) );

            ////中间高度为  =  最低点+(最高点-最低点)*(当前像素-1)/(255-1)   hmin="277" hmax="2503"/
            //double z = hmin + (hmax - hmin) * (hdt - 1.0f) / 254.0f;

            //return z;
        }