public LuaAPI() { //////////////////////////////////////////////////////// /// Interfaces/Classes setter ifs = new INIManager(@"..\setting.ini"); lua = new Lua(); //////////////////////////////////////////////////////// /// CFG setter cfg = ifs.GetString("global", "config"); userdata = ifs.GetString("global", "user"); scripts = ifs.GetString("global", "scripts"); images = ifs.GetString("global", "img"); snd = ifs.GetString("global", "SoundActive"); //////////////////////////////////////////////////////// /// Lua namespace setter lua["IFS"] = new INIManager(); lua["Text"] = ""; lua["ActorName"] = ""; lua["Sound"] = "0"; lua.NewTable("Font"); lua.NewTable("Scene"); lua.NewTable("MainMenu"); lua.RegisterFunction("AddLoaderHook", this, typeof(LuaAPI).GetMethod("SetHook")); }
private void LoadList_SelectedIndexChanged(object sender, EventArgs e) { string path = LuaAPI.userdata + LoadList.SelectedItem.ToString(); isVisualNovel = ifs.GetString(path, "param", "mode") == "VisualNovel"; GameScenarioFile = ifs.GetString(path, "param", "game"); if (!isVisualNovel) { InitObjectsList(); for (int Iter = 0; Iter < UsSectList.Length; Iter++) { UsSectList[Iter].Load(ref ifs, path, Iter); } } else { UsSectList = new SectionEditon[1]; } UsSectList[0] = new SectionEditon { Idx = 0, Section = 0, SectionNext = 0, SectionLabel = 0, SectionLabelOld = 0, SectionString = "", SectionStringOld = "" }; UsSectList[0].Load(ref ifs, path, 0); // Restored LuaTables int LayerCount = Convert.ToInt32(ifs.GetString(path, "layer", "count")); lua.lua.GetTable("Scene")["Images"] = LayerCount; for (int Iter = 0; Iter < LayerCount; Iter++) { lua.lua.GetTable("Scene")["Image" + Iter.ToString()] = ifs.GetString(path, "layer", "layer" + Iter.ToString()); } lua.SetHook(ifs.GetString(path, "layer", "hook")); lua.CallHook(); LoadList.Visible = false; MenuUpdate(false); if (isVisualNovel) { NextScene(true, ref UsSectList[0]); } MessBox_1.Visible = true; }
public void Load(ref INIManager ifs, string path, int NewIdx) { Idx = NewIdx; Section = Convert.ToInt32(ifs.GetString(path, "param", Idx.ToString() + "sect")); SectionStringOld = ifs.GetString(path, "param", Idx.ToString() + "sect_old"); SectionString = ifs.GetString(path, "param", Idx.ToString() + "sect_string"); SectionLabel = Convert.ToInt32(ifs.GetString(path, "param", Idx.ToString() + "sect_label")); }
public MainWindow() { InitializeComponent(); /// CFG setter cfg = IFS.GetString("global", "config"); userdata = IFS.GetString("global", "user"); scripts = IFS.GetString("global", "scripts"); images = IFS.GetString("global", "img"); snd = IFS.GetString("global", "SoundActive"); }
//Code public Form1() { /// Init /// /// ContextBox Context = new Loopie.Code.Content.ContextBox(); Context.BackColor = Color.Transparent; this.Controls.Add(this.Context); Context.Visible = false; SectionID = 0; UsSectList = new SectionEditon[1]; ///////////////////////////////////////////////////////////////////// /// ETC setter ifs = new INIManager(); lua = new LuaAPI(); /// /// General InitializeComponent(); MainMenuInit(); this.SaveButton.Parent = UniversalPanel; //this.TopMost = true; this.MessBox_1.BackgroundImage = new Bitmap(LuaAPI.images + "box.png"); this.KeyDown += KeyDownHandle; this.MouseDown += MouseDownHandle; this.FullscreenCheckBox.CheckedChanged += FullscreenHandle; this.FullscreenCheckBox.BackColor = Color.Transparent; this.UniversalPanel.BackColor = Color.Transparent; this.SpeakerName.Parent = MessBox_1; ///////////////////////////////////////////////////////////////////// /// Mess setter this.MessBox_1.MouseDown += MouseDownHandle; ///////////////////////////////////////////////////////////////////// /// Vars setter player = new System.Windows.Media.MediaPlayer(); SpeakerTextString = ""; SoundOldName = "0"; TextWidth = MessBox_1.Width / 11; SoundActive = false; SpriteListPic = new Bitmap(this.Size.Width, this.Size.Height); try { FullscreenCheckBox.Checked = Convert.ToBoolean(ifs.GetString(@"..\\setting.ini", "settings", "fullscreen")); SoundFlagCheck.Checked = Convert.ToBoolean(ifs.GetString(@"..\\setting.ini", "settings", "sound")); } finally { SoundFlagCheck.Checked = true; FullscreenCheckBox.Checked = false; } GameStarted = false; lua.lua.RegisterFunction("AddContextBox", this, typeof(Form1).GetMethod("MakeContextBox")); lua.lua.RegisterFunction("RemoveContextBox", this, typeof(Form1).GetMethod("ClosedContextBox")); }