示例#1
0
 public ScreenJournal(Module m, GameView g)
 {
     mod = m;
     gv = g;
     //journalBack = gv.cc.LoadBitmap("journalback"); // BitmapFactory.decodeResource(gv.getResources(), R.drawable.journalback);
     //setControlsStart();
 }
示例#2
0
 public ScreenShop(Module m, GameView g)
 {
     mod = m;
     gv = g;
     setControlsStart();
     stringMessageShop = gv.cc.loadTextToString("data/MessageShop.txt");
 }
 public ScreenTraitLevelUp(Module m, GameView g)
 {
     mod = m;
     gv = g;
     setControlsStart();
     pc = new Player();
     stringMessageTraitLevelUp = gv.cc.loadTextToString("data/MessageTraitLevelUp.txt");
 }
示例#4
0
 public ScreenCombat(Module m, GameView g)
 {
     mod = m;
     gv = g;
     mapStartLocXinPixels = 6 * gv.squareSize;
     setControlsStart();
     setToggleButtonsStart();
 }
示例#5
0
 public ScreenParty(Module m, GameView g)
 {
     mod = m;
     gv = g;
     setControlsStart();
     description = new IbbHtmlTextBox(gv, 320, 100, 500, 300);
     description.showBoxBorder = false;
 }
示例#6
0
 public ScreenPcCreation(Module m, GameView g)
 {
     mod = m;
     gv = g;
     blankItemSlot = gv.cc.LoadBitmap("item_slot");
     setControlsStart();
     LoadPlayerBitmapList();
     CreateRaceList();
     resetPC();
 }
示例#7
0
 public ScreenLauncher(Module m, GameView g)
 {
     mod = m;
     gv = g;
     setControlsStart();
     int pH = (int)((float)gv.screenHeight / 100.0f);
     description = new IbbHtmlTextBox(gv);
     description.tbXloc = 0 * gv.squareSize + gv.oXshift;
     description.tbYloc = 6 * gv.squareSize + gv.oYshift;
     description.tbWidth = 16 * gv.squareSize;
     description.tbHeight = 6 * gv.squareSize;
     description.showBoxBorder = false;
 }
示例#8
0
 public PathFinderAreas(Module m)
 {
     mod = m;
 }
 public PathFinderEncounters(Module m)
 {
     mod = m;
 }
示例#10
0
 public ScreenItemSelector(Module m, GameView g)
 {
     mod = m;
     gv = g;
     //setControlsStart();
 }
示例#11
0
 public void updateContainers(Module saveMod)
 {
     foreach (Container saveCnt in saveMod.moduleContainersList)
     {
         //fill container with items that are still in the saved game
         Container updatedCont = gv.mod.getContainerByTag(saveCnt.containerTag);
         if (updatedCont != null)
         {
             //this container in the save also exists in the newMod so clear it out and add everything in the save
             updatedCont.containerItemRefs.Clear();
             foreach (ItemRefs it in saveCnt.containerItemRefs)
             {
                 //check to see if item resref in save game container still exists in toolset
                 Item newItem = gv.mod.getItemByResRef(it.resref);
                 if (newItem != null)
                 {
                     updatedCont.containerItemRefs.Add(it.DeepCopy());
                 }
             }
             //compare lists and add items that are new
             foreach (ItemRefs itemRef in updatedCont.initialContainerItemRefs)
             {
                 //check to see if item in toolset does not exist in save initial list so it is new and add it
                 if (!saveCnt.containsInitialItemWithResRef(itemRef.resref))
                 {
                     //item is not in the saved game initial container item list so add it to the container
                     //check to see if item resref in save game container still exists in toolset
                     Item newItem = gv.mod.getItemByResRef(itemRef.resref);
                     if (newItem != null)
                     {
                         updatedCont.containerItemRefs.Add(itemRef.DeepCopy());
                     }
                 }
             }
         }
     }
 }
示例#12
0
 public void updateShops(Module saveMod)
 {
     foreach (Shop saveShp in saveMod.moduleShopsList)
     {
         Shop updatedShop = gv.mod.getShopByTag(saveShp.shopTag);
         if (updatedShop != null)
         {
             //this shop in the save also exists in the newMod so clear it out and add everything in the save
             updatedShop.shopItemRefs.Clear();
             foreach (ItemRefs it in saveShp.shopItemRefs)
             {
                 Item newItem = gv.mod.getItemByResRef(it.resref);
                 if (newItem != null)
                 {
                     updatedShop.shopItemRefs.Add(it.DeepCopy());
                 }
             }
             //compare lists and add items that are new
             foreach (ItemRefs itemRef in updatedShop.initialShopItemRefs)
             {
                 if (!saveShp.containsInitialItemWithResRef(itemRef.resref))
                 {
                     //item is not in the saved game initial container item list so add it to the container
                     Item newItem = gv.mod.getItemByResRef(itemRef.resref);
                     if (newItem != null)
                     {
                         updatedShop.shopItemRefs.Add(itemRef.DeepCopy());
                     }
                 }
             }
         }
     }
 }
示例#13
0
        public Bitmap LoadBitmap(string filename, Module mdl)
        {
            Bitmap bm = null;

            try
            {
                if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename + ".jpg"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename + ".jpg");
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\graphics\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\ui\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\ui\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\ui\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\ui\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\pctokens\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\pctokens\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\pctokens\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\pctokens\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\tiles\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\tiles\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\tiles\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\modules\\" + mdl.moduleName + "\\tiles\\" + filename);
                }

                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename + ".jpg"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename + ".jpg");
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\graphics\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\ui\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\ui\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\ui\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\ui\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\pctokens\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\pctokens\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\pctokens\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\pctokens\\" + filename);
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\tiles\\" + filename + ".png"))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\tiles\\" + filename + ".png");
                }
                else if (File.Exists(gv.mainDirectory + "\\default\\NewModule\\tiles\\" + filename))
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\tiles\\" + filename);
                }

                else
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\graphics\\missingtexture.png");
                }
                //if (bm == null)
                //{
                //    bm = BitmapFactory.decodeResource(gv.getResources(), R.drawable.ui_missingtexture);
                //}
            }
            catch (Exception e)
            {
                if (bm == null)
                {
                    bm = new Bitmap(gv.mainDirectory + "\\default\\NewModule\\graphics\\missingtexture.png");
                    return bm;
                }
            }

            return bm;
        }
示例#14
0
        public void updateAreas(Module saveMod)
        {
            foreach (Area ar in gv.mod.moduleAreasObjects)
            {
                foreach (Area sar in saveMod.moduleAreasObjects)
                {
                    if (sar.Filename.Equals(ar.Filename)) //sar is saved game, ar is new game from toolset version
                    {
                        //locals
                        ar.AreaLocalInts.Clear();
                        foreach (LocalInt l in sar.AreaLocalInts)
                        {
                            ar.AreaLocalInts.Add(l.DeepCopy());
                        }
                        ar.AreaLocalStrings.Clear();
                        foreach (LocalString l in sar.AreaLocalStrings)
                        {
                            ar.AreaLocalStrings.Add(l.DeepCopy());
                        }

                        //tiles
                        for (int index = 0; index < ar.Tiles.Count; index++)
                        {
                            ar.Tiles[index].Visible = sar.Tiles[index].Visible;
                        }

                        //props
                        //start at the end of the newMod prop list and work up
                        //if the prop tag is found in the save game, update it
                        //else if not found in saved game, but exists in the
                        //saved game initial list (the toolset version of the prop list), remove prop
                        //else leave it alone
                        for (int index = ar.Props.Count - 1; index >= 0; index--)
                        {
                            Prop prp = ar.Props[index];
                            bool foundOne = false;
                            foreach (Prop sprp in sar.Props) //sprp is the saved game prop
                            {
                                if (prp.PropTag.Equals(sprp.PropTag))
                                {
                                    foundOne = true; //the prop tag exists in the saved game
                                    //replace the one in the toolset with the one from the saved game
                                    ar.Props.RemoveAt(index);
                                    ar.Props.Add(sprp.DeepCopy());
                                    //prp = sprp.DeepCopy();
                                    break;
                                }
                            }
                            if (!foundOne) //didn't find the prop tag in the saved game
                            {
                                if (sar.InitialAreaPropTagsList.Contains(prp.PropTag))
                                {
                                    //was once on the map, but was deleted so remove from the newMod prop list
                                    ar.Props.RemoveAt(index);
                                }
                                else
                                {
                                    //is new to the mod so leave it alone, don't remove from the prop list
                                }
                            }
                        }
                        //triggers
                        foreach (Trigger tr in ar.Triggers)
                        {
                            foreach (Trigger str in sar.Triggers)
                            {
                                if (tr.TriggerTag.Equals(str.TriggerTag))
                                {
                                    tr.Enabled = str.Enabled;
                                    tr.EnabledEvent1 = str.EnabledEvent1;
                                    tr.EnabledEvent2 = str.EnabledEvent2;
                                    tr.EnabledEvent3 = str.EnabledEvent3;
                                    //may want to copy the trigger's squares list from the save game if builders can modify the list with scripts
                                }
                            }
                        }
                    }
                }
            }
        }
示例#15
0
 public ScreenTitle(Module m, GameView g)
 {
     mod = m;
     gv = g;
     setControlsStart();
 }
示例#16
0
 public ScreenCastSelector(Module m, GameView g)
 {
     mod = m;
     gv = g;
     stringMessageCastSelector = gv.cc.loadTextToString("data/MessageCastSelector.txt");
 }
示例#17
0
 public ScreenPcSelector(Module m, GameView g)
 {
     //gv.mod = m;
     gv = g;
     setControlsStart();
 }
示例#18
0
 public ScriptFunctions(Module m, GameView g)
 {
     mod = m;
     gv = g;
     rand = new Random();
 }
示例#19
0
 public PathFinder(Module m)
 {
     mod = m;
 }
示例#20
0
        public void resetGame()
        {
            //mod = new Module();
            mod = cc.LoadModule(mod.moduleName + ".mod", false);
            mod.debugMode = false;
            mod.loadAreas(this);
            mod.setCurrentArea(mod.startingArea, this);
            mod.PlayerLocationX = mod.startingPlayerPositionX;
            mod.PlayerLocationY = mod.startingPlayerPositionY;
            cc.title = cc.LoadBitmap("title"); // BitmapFactory.decodeResource(getResources(), R.drawable.nar_lanterna);
            LoadStandardImages();
            cc.LoadRaces();
            cc.LoadPlayerClasses();
            cc.LoadItems();
            cc.LoadContainers();
            cc.LoadShops();
            cc.LoadEffects();
            cc.LoadSpells();
            cc.LoadTraits();
            cc.LoadCreatures();
            cc.LoadEncounters();
            cc.LoadJournal();
            cc.LoadTileBitmapList();

            foreach (Container c in mod.moduleContainersList)
            {
                c.initialContainerItemRefs.Clear();
                foreach (ItemRefs i in c.containerItemRefs)
                {
                    c.initialContainerItemRefs.Add(i.DeepCopy());
                }
            }
            foreach (Shop s in mod.moduleShopsList)
            {
                s.initialShopItemRefs.Clear();
                foreach (ItemRefs i in s.shopItemRefs)
                {
                    s.initialShopItemRefs.Add(i.DeepCopy());
                }
            }
            foreach (Area a in mod.moduleAreasObjects)
            {
                a.InitialAreaPropTagsList.Clear();
                foreach (Prop p in a.Props)
                {
                    a.InitialAreaPropTagsList.Add(p.PropTag);
                }
            }

            cc.nullOutControls();
            cc.setControlsStart();
            cc.setToggleButtonsStart();
            createScreens();
            initializeSounds();

            cc.LoadTestParty();
            //LogText.clear();

            //load all the message box helps/tutorials
            cc.stringBeginnersGuide = cc.loadTextToString("MessageBeginnersGuide.txt");
            cc.stringPlayersGuide = cc.loadTextToString("MessagePlayersGuide.txt");
            cc.stringPcCreation = cc.loadTextToString("MessagePcCreation.txt");
            cc.stringMessageCombat = cc.loadTextToString("MessageCombat.txt");
            cc.stringMessageInventory = cc.loadTextToString("MessageInventory.txt");
            cc.stringMessageParty = cc.loadTextToString("MessageParty.txt");
            cc.stringMessageMainMap = cc.loadTextToString("MessageMainMap.txt");
        }
示例#21
0
        //public bool logUpdated = false;
        //public int drawCount = 0;
        //public int mouseCount = 0;
        public GameView()
        {
            InitializeComponent();
            this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.GameView_MouseWheel);
            mainDirectory = Directory.GetCurrentDirectory();

            this.IceBlinkButtonClose.setupAll(this);
            this.IceBlinkButtonResize.setupAll(this);
            try
            {
                playerButtonClick.SoundLocation = mainDirectory + "\\default\\NewModule\\sounds\\btn_click.wav";
                playerButtonClick.Load();
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            try
            {
                playerButtonEnter.SoundLocation = mainDirectory + "\\default\\NewModule\\sounds\\btn_hover.wav";
                playerButtonEnter.Load();
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }

            this.WindowState = FormWindowState.Maximized;
            this.Width = 1366;
            this.Height = 768;
            screenWidth = this.Width; //getResources().getDisplayMetrics().widthPixels;
            screenHeight = this.Height; //getResources().getDisplayMetrics().heightPixels;
            float sqrW = (float)screenWidth / (float)squaresInWidth;
            float sqrH = (float)screenHeight / (float)squaresInHeight;
            if (sqrW > sqrH)
            {
                squareSize = (int)(sqrH);
            }
            else
            {
                squareSize = (int)(sqrW);
            }
            if ((squareSize > 100) && (squareSize < 120))
            {
                squareSize = 100;
            }
            screenDensity = (float)squareSize / (float)squareSizeInPixels;
            oXshift = (screenWidth - (squareSize * squaresInWidth)) / 2;

            //CREATES A FONTFAMILY
            //(LOOK THE out word in the parameter sent to the method, that will modify myFonts object)
            family = LoadFontFamily(mainDirectory + "\\default\\NewModule\\fonts\\Metamorphous-Regular.ttf", out myFonts);
            float multiplr = (float)squareSize / 100.0f;
            drawFontLarge = new Font(family, 24.0f * multiplr);
            drawFontReg = new Font(family, 20.0f * multiplr);
            drawFontSmall = new Font(family, 16.0f * multiplr);

            animationTimer.Tick += new System.EventHandler(this.AnimationTimer_Tick);
            floatyTextTimer.Tick += new System.EventHandler(this.FloatyTextTimer_Tick);
            floatyTextMainMapTimer.Tick += new System.EventHandler(this.FloatyTextMainMapTimer_Tick);

            cc = new CommonCode(this);
            mod = new Module();

            log = new IbbHtmlLogBox(this, 0 * squareSize + oXshift - 3, 0 * squareSize + oYshift, 6 * squareSize, 7 * squareSize);
            log.numberOfLinesToShow = 20;
            cc.addLogText("red", "screenDensity: " + screenDensity);
            cc.addLogText("fuchsia", "screenWidth: " + screenWidth);
            cc.addLogText("lime", "screenHeight: " + screenHeight);
            cc.addLogText("yellow", "squareSize: " + squareSize);
            cc.addLogText("yellow", "sqrW: " + sqrW);
            cc.addLogText("yellow", "sqrH: " + sqrH);
            cc.addLogText("yellow", "");
            cc.addLogText("red", "Welcome to IceBlink 2");
            cc.addLogText("fuchsia", "You can scroll this message log box, use mouse wheel or scroll bar");

            //TODOinitializeMusic();
            //TODOinitializeCombatMusic();

            if (fixedModule.Equals("")) //this is the IceBlink Engine app
            {
                screenLauncher = new ScreenLauncher(mod, this);
                screenLauncher.loadModuleFiles();
                screenType = "launcher";
            }
            else //this is a fixed module
            {
                mod = cc.LoadModule(fixedModule + "/" + fixedModule + ".mod", false);
                resetGame();
                cc.LoadSaveListItems();
                screenType = "title";
            }
        }