示例#1
0
        /// ///////////////////////////////////////////////////////////////////////////////////////////////

        //构造函数,初始化资源
        public TYYCoreDataDyn()
        {
            try
            {
                //资源初始化

                //角色
                tyyCharacterLocation = TYYCoreProcess.tyyProcessCenterPosition(savData.tyyMapLoc, this.tyyWindowSize);
                //地图
                tyyMapLocation = savData.tyyMapLoc;
                //TOWARDS
                tyyCharacterImageTowardsImages.Add(towardStop);
                tyyCharacterImageTowardsImages.Add(towardWalk1);
                tyyCharacterImageTowardsImages.Add(towardStop);
                tyyCharacterImageTowardsImages.Add(towardWalk2);
                //BACK
                tyyCharacterImageBackImages.Add(backStop);
                tyyCharacterImageBackImages.Add(backWalk1);
                tyyCharacterImageBackImages.Add(backStop);
                tyyCharacterImageBackImages.Add(backWalk2);
                //LEFT
                tyyCharacterImageLeftImages.Add(leftStop);
                tyyCharacterImageLeftImages.Add(leftWalk1);
                tyyCharacterImageLeftImages.Add(leftStop);
                tyyCharacterImageLeftImages.Add(leftWalk2);
                //RIGHT
                tyyCharacterImageRightImages.Add(rightStop);
                tyyCharacterImageRightImages.Add(rightWalk1);
                tyyCharacterImageRightImages.Add(rightStop);
                tyyCharacterImageRightImages.Add(rightWalk2);

                //water
                tyyWaterImages.Add(Properties.Resources.wat_1);
                tyyWaterImages.Add(Properties.Resources.wat_2);
                tyyWaterImages.Add(Properties.Resources.wat_3);
                tyyWaterImages.Add(Properties.Resources.wat_4);
                tyyWaterImages.Add(Properties.Resources.wat_5);
                tyyWaterImages.Add(Properties.Resources.wat_6);
                tyyWaterImages.Add(Properties.Resources.wat_7);
                tyyWaterImages.Add(Properties.Resources.wat_8);
            }
            catch
            {
                TYYCoreGUI.tyyErrMsg("Game Frame Init Failed!");
            }
        }
示例#2
0
        //地图角色初始化函数
        public static void tyyInitCharacterWithMap(PictureBox _mainCharacter, PictureBox _mainMap, Image mapImage, Boolean isMapTr)
        {
            //contect
            _mainCharacter.Parent = _mainMap;

            _mainMap.Image = mapImage;

            _mainCharacter.Size = new Size(TYYCoreDataDyn.tyyInitCharacterSize);

            _mainMap.Size = mapImage.Size;
            //error happens
            if (!isMapTr)
            {
                Point sizeofWin = new Point(800, 600);
                _mainCharacter.Location = DynData.tyyCharacterLocation;
                _mainMap.Location       = TYYCoreProcess.tyyProcessCenterPosition(_mainCharacter.Location, sizeofWin, true);
            }
            //重定义窗口大小


            _mainCharacter.Image = TYYCoreDataDyn.tyyCharacterImage;

            _mainCharacter.BackColor = Color.Transparent;
        }
示例#3
0
        //private define functions
        private void tyyInitMapFrame(String mapName)
        {
            this._mainCharacter.Visible = false;
            this._mainMap.Visible       = false;
            //储存之前读取地图坐标
            Point prevMapLoc = new Point();

            //dispose resource - ok
            TYYCoreProcess.tyyProcessDisposeImg(ObjectsGen);
            TYYCoreProcess.tyyProcessDisposeImg(ObjectsTre);
            TYYCoreProcess.tyyProcessDisposeImg(ObjectsWat);
            TYYCoreProcess.tyyProcessDisposeImg(ObjectsNpc);
            ObjAnimation.tyyWatNums = 0;
            //init map - ok
            //main character&map
            if (isEnterLoad && mapName == null)
            {
                //保存地图名称
                mapName       = ObjDataLoc.tyyGetMapName();
                ObjMapCharger = new TYYCoreMapCharger(mapName);
                //初始化资源
                isEnterLoad = false;
                //初始化地图
                TYYCoreInit.tyyInitCharacterWithMap(_mainCharacter, _mainMap, ObjMapCharger.tyyMapImage, false);
            }
            else if (mapName != null && isEnterLoad == false)
            {
                Point formSize = new Point(this.Size);
                prevMapLoc              = ObjMapCharger.tyyMapTrCharacterNxt[ObjAnimation.tyyMapIndex];
                ObjMapCharger           = new TYYCoreMapCharger(ObjMapCharger.tyyMapTrName[ObjAnimation.tyyMapIndex]);
                _mainCharacter.Location = prevMapLoc;

                _mainMap.Location = TYYCoreProcess.tyyProcessCenterPosition(_mainCharacter.Location, formSize, true);
                //初始化地图
                TYYCoreInit.tyyInitCharacterWithMap(_mainCharacter, _mainMap, ObjMapCharger.tyyMapImage, true);
            }

            //double buffer
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

            ObjAnimation.mainMap        = _mainMap;
            ObjAnimation.mainCharacter  = _mainCharacter;
            ObjAnimation.referencePrint = _referencePrint;
            ObjAnimation.mainForm       = this;
            ObjAnimation.dlgForm        = ObjAnimation.tyyDlg;
            ObjAnimation.mapSize        = new Point(ObjMapCharger.tyyMapImage.Size);
            //这里增加额外代码
            ObjMapCharger = new TYYCoreMapCharger(mapName, TYYObjectName.tyyTree);
            tyyInitObjects(TYYObjectName.tyyTree);

            ObjMapCharger = new TYYCoreMapCharger(mapName, TYYObjectName.tyyNpc);
            tyyInitObjects(TYYObjectName.tyyNpc);

            ObjMapCharger = new TYYCoreMapCharger(mapName, TYYObjectName.tyyWater);
            tyyInitObjects(TYYObjectName.tyyWater);

            ObjMapCharger = new TYYCoreMapCharger(mapName, TYYObjectName.tyyGen);
            tyyInitObjects(TYYObjectName.tyyGen);
            //initObjcts is not been fix

            //请在这上面增加代码
            ObjMapCharger            = new TYYCoreMapCharger(mapName, TYYObjectName.tyyTr);
            ObjAnimation.pointStart  = ObjMapCharger.tyyPointStart;
            ObjAnimation.pointEnd    = ObjMapCharger.tyyPointEnd;
            ObjAnimation.LEVEL_INDEX = ObjMapCharger.LEVEL_INDEX;
            this._MapLoc.Text        = ObjMapCharger.tyyMapLocName;

            tyyLevelUp(this._MapLoc.Text);
            this._mainMap.Refresh();
            this._mainCharacter.Visible = true;
            this._mainMap.Visible       = true;
        }