Esempio n. 1
0
        public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi)
        {
            this.LoadThumbnail(si, ps);

            if (si.PackageCacheItem.Type == PackageType.Neighborhood)
            {
                Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.IDNO);
                if (pfds.Length > 0)
                {
                    Idno idno = new Idno();
                    idno.ProcessData(pfds[0], si.Package);

                    ps.Data    = new uint[2];
                    ps.Data[0] = (uint)idno.Type;
                    ps.Data[1] = idno.Uid;

                    //check for duplicates
                    if (ids.Contains(idno.Uid))
                    {
                        ps.State = TriState.False;
                    }
                    else
                    {
                        ps.State = TriState.True;
                    }
                }
            }

            if (si.PackageCacheItem.Thumbnail != null && WaitingScreen.Running)
            {
                WaitingScreen.UpdateImage(si.PackageCacheItem.Thumbnail);
            }
            UpdateState(si, ps, lvi);
        }
Esempio n. 2
0
        private void RcolSearch(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (cbusefileindex.Checked)
            {
                WaitingScreen.Wait();
                try { SimPe.FileTable.FileIndex.Load(); }
                finally { WaitingScreen.Stop(this); }

                lblist.Items.Clear();
                SimPe.Packages.PackedFileDescriptor pfd = new SimPe.Packages.PackedFileDescriptor();
                pfd.SubType  = Hashes.SubTypeHash(Hashes.StripHashFromName(tbflname.Text));
                pfd.Instance = Hashes.InstanceHash(Hashes.StripHashFromName(tbflname.Text));

                SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFileByInstance(pfd.LongInstance);

                //short Index
                if (items.Length == 0)
                {
                    pfd.SubType = 0;
                    items       = FileTable.FileIndex.FindFileByInstance(pfd.LongInstance);
                }

                foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items)
                {
                    lblist.Items.Add(item.Package.FileName);
                }

                btopen.Tag = true;
            }
            else
            {
                this.StartSearch(new SeekerFunction(this.RcolSearch), package.FindFile(Hashes.StripHashFromName(tbflname.Text)));
            }
        }
Esempio n. 3
0
        protected void UpdateList()
        {
            WaitingScreen.Wait();
            Application.DoEvents();

            try
            {
                lv.Items.Clear();
                ilist.Images.Clear();

                ExpansionItem.NeighborhoodPaths paths = PathProvider.Global.GetNeighborhoodsForGroup(PathProvider.Global.CurrentGroup);
                foreach (ExpansionItem.NeighborhoodPath path in paths)
                {
                    string   sourcepath = path.Path;
                    string[] dirs       = System.IO.Directory.GetDirectories(sourcepath, "????");
                    foreach (string dir in dirs)
                    {
                        AddNeighborhood(path, dir);
                    }
                }
            }
            finally
            {
                WaitingScreen.Stop(this);
            }
        }
Esempio n. 4
0
        protected void AddImage(string path)
        {
            string name = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), System.IO.Path.GetFileNameWithoutExtension(path) + ".png");

            //name = System.IO.Path.Combine(path, name);
            if (System.IO.File.Exists(name))
            {
                try
                {
                    System.IO.Stream st  = System.IO.File.OpenRead(name);
                    Image            img = Image.FromStream(st);
                    st.Close();
                    st.Dispose();
                    st = null;
                    if (WaitingScreen.Running)
                    {
                        WaitingScreen.UpdateImage(ImageLoader.Preview(img, WaitingScreen.ImageSize));
                    }
                    this.ilist.Images.Add(img);
                    return;
                }
                catch (System.ArgumentException) { }
            }
            this.ilist.Images.Add(new Bitmap(this.GetType().Assembly.GetManifestResourceStream("SimPe.Plugin.Network.png")));
        }
Esempio n. 5
0
        public static void Execute(SimPe.Plugin.Anim.AnimResourceConst anim)
        {
            AnimPreview f = new AnimPreview();

            WaitingScreen.Wait();
            Wait.SubStart(anim.MeshBlock.Length);
            try
            {
                WaitingScreen.UpdateMessage(SimPe.Localization.GetString("Loading Meshes"));
                int ct = 0;
                foreach (SimPe.Plugin.Anim.AnimationMeshBlock amb in anim.MeshBlock)
                {
                    f.lb.Items.Add(new ListedMeshBlocks(amb));
                    Wait.Progress = ct++;
                }
            }
            finally
            {
                Wait.SubStop();
                WaitingScreen.Stop();
            }

            f.ShowDialog();

            f.timer1.Enabled = false;
        }
Esempio n. 6
0
        /// <summary>
        /// Show the Graph
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="fileindex"></param>
        /// <remarks>Do not run twice</remarks>
        public void BuildGraph(SimPe.Interfaces.Files.IPackageFile pkg, SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex)
        {
            gc.BeginUpdate();
            gc.Clear();
            gc.SaveBounds = false;
            gc.AutoSize   = true;
            this.coords.Clear();
            this.names.Clear();
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Scaning MMAT Tree");
            }
            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = pkg.FindFiles(Data.MetaData.MMAT);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                AddItem(pfd, pkg, null, fileindex);
            }

            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Scaning CRES Tree");
            }
            pfds = pkg.FindFiles(Data.MetaData.CRES);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                AddItem(pfd, pkg, null, fileindex);
            }

            gc.AutoSize   = false;
            gc.SaveBounds = true;
            gc.EndUpdate();
        }
Esempio n. 7
0
 /// <summary>
 /// Returns the Thumbnail of an Object
 /// </summary>
 /// <param name="group"></param>
 /// <param name="modelname"></param>
 /// <returns>The Thumbnail</returns>
 public static Image GetThumbnail(string message, uint[] types, uint group, uint inst, SimPe.Packages.File thumbs)
 {
     foreach (uint type in types)
     {
         //0x6C2A22C3
         Interfaces.Files.IPackedFileDescriptor[] pfds = thumbs.FindFile(type, group, inst);
         if (pfds.Length == 0)
         {
             pfds = thumbs.FindFile(type, 0, inst);
         }
         if (pfds.Length > 0)
         {
             Interfaces.Files.IPackedFileDescriptor pfd = pfds[0];
             try
             {
                 SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture();
                 pic.ProcessData(pfd, thumbs);
                 Bitmap bm = (Bitmap)ImageLoader.Preview(pic.Image, WaitingScreen.ImageSize);
                 if (WaitingScreen.Running)
                 {
                     WaitingScreen.Update(bm, message);
                 }
                 return(pic.Image);
             }
             catch (Exception) {}
         }
     }
     return(null);
 }
Esempio n. 8
0
        /// <summary>
        /// Add all Files that could be borrowed from the current package by the passed one, to the passed package
        /// </summary>
        /// <param name="orgmodelnames">List of available modelnames in this package</param>
        /// <param name="pkg">The package that should receive the Files</param>
        /// <remarks>Simply Copies MMAT, LIFO, TXTR and TXMT Files</remarks>
        public void AddParentFiles(string[] orgmodelnames, SimPe.Interfaces.Files.IPackageFile pkg)
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Loading Parent Files");
            }
            ArrayList names = new ArrayList();

            foreach (string s in orgmodelnames)
            {
                names.Add(s);
            }

            ArrayList types = new ArrayList();

            types.Add(Data.MetaData.MMAT);
            types.Add(Data.MetaData.TXMT);
            types.Add(Data.MetaData.TXTR);
            types.Add(Data.MetaData.LIFO);

            foreach (uint type in types)
            {
                SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(type);
                foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    if (pkg.FindFile(pfd) != null)
                    {
                        continue;
                    }

                    SimPe.Interfaces.Files.IPackedFile file = package.Read(pfd);
                    pfd.UserData = file.UncompressedData;

                    //Update the modeName in the MMAT
                    if ((pfd.Type == Data.MetaData.MMAT) && (names.Count > 0))
                    {
                        SimPe.Plugin.MmatWrapper mmat = new MmatWrapper();
                        mmat.ProcessData(pfd, package);

                        string n = mmat.ModelName.Trim().ToLower();
                        if (!n.EndsWith("_cres"))
                        {
                            n += "_cres";
                        }

                        if (!names.Contains(n))
                        {
                            n = names[0].ToString();
                            //n = n.Substring(0, n.Length-5);
                            mmat.ModelName = n;
                            mmat.SynchronizeUserData();
                        }
                    }

                    pkg.Add(pfd);
                }
            }             //foreach type
        }
Esempio n. 9
0
        /// <summary>
        /// Install the Photostudio Templates
        /// </summary>
        /// <returns>true if success</returns>
        public static bool InstallTemplates()
        {
            WebClient Client = new WebClient();

            if (Helper.StartedGui == Executable.Classic)
            {
                WaitingScreen.Wait();
            }
            else
            {
                Wait.SubStart();
            }
            try
            {
                string tempname = System.IO.Path.GetTempFileName() + ".exe";
                DownloadFile("http://sims.ambertation.de/files/SimPE-Templates-Setup.exe", tempname);

                if (Helper.StartedGui == Executable.Classic)
                {
                    WaitingScreen.Stop();
                }
                else
                {
                    Wait.SubStop();
                }
                try
                {
                    System.Diagnostics.Process p = System.Diagnostics.Process.Start(tempname);
                    p.WaitForExit();

                    return(true);
                }
                finally
                {
                    System.IO.File.Delete(tempname);
                }
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("Unable to download the instalation File.", ex);
            }
            finally
            {
                if (Helper.StartedGui == Executable.Classic)
                {
                    WaitingScreen.Stop();
                }
                else
                {
                    Wait.SubStop();
                }
            }

            return(false);
        }
Esempio n. 10
0
 private void OnMouseDown()
 {
     if (!StopCollider.IsCollision)
     {
         if (!MessageSystemPlayingScene.IsDead)
         {
             WaitingScreen.wait(MessageSystemPlayingScene.DisableCollider());
         }
         transform.localScale = new Vector3(changeScale, changeScale, 1);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Doanload A File from the Internet
        /// </summary>
        /// <param name="URL"></param>
        /// <param name="Filename"></param>
        /// <param name="progress"></param>
        public static void DownloadFile(string URL, string Filename)
        {
            WebClient cli = new WebClient();
            Stream    fDnld = null, fOut = null;

            if (Helper.StartedGui == Executable.Classic)
            {
                WaitingScreen.Wait();
            }
            else
            {
                Wait.SubStart();
            }
            int total = 0;

            try
            {
                fDnld = cli.OpenRead(URL);
                string sTotal = cli.ResponseHeaders["Content-Length"];
                int    nTotal = (sTotal == null || sTotal.Length == 0) ? 0 : Convert.ToInt32(sTotal);

                fOut = File.Create(Filename);
                byte[] buf = new byte[4096];
                int    nBytesRead;
                while ((nBytesRead = fDnld.Read(buf, 0, buf.Length)) > 0)
                {
                    total += nBytesRead;
                    WaitingScreen.UpdateMessage(total.ToString() + " of " + nTotal.ToString());
                    Wait.Message = total.ToString() + " of " + nTotal.ToString();
                    fOut.Write(buf, 0, nBytesRead);
                }
            }
            catch { throw; }
            finally
            {
                if (Helper.StartedGui == Executable.Classic)
                {
                    WaitingScreen.Stop();
                }
                else
                {
                    Wait.SubStop();
                }
                if (fDnld != null)
                {
                    fDnld.Close();
                }
                if (fOut != null)
                {
                    fOut.Close(); fOut.Dispose(); fOut = null;
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Gestiona cualquier pulsación para <see cref="WaitingScreen"/>
        /// </summary>
        /// <param name="waitingScreen">Escena de espera que llama al método</param>
        /// <param name="gameTime">Valor de tiempo actual</param>
        public static void Waiting(WaitingScreen waitingScreen, GameTime gameTime)
        {
            MouseState mState = Mouse.GetState();

            if (mState.LeftButton == ButtonState.Pressed && waitingScreen.disconnectRect.Contains(mState.Position))
            {
                waitingScreen.Connection.Disconnect();
                GameMain.currentScreen = new MenuScreen(waitingScreen.Content, waitingScreen.GraphicsDevice);
            }

            mOldState = mState;
        }
Esempio n. 13
0
        /// <summary>
        /// Build the SceneGraph
        /// </summary>
        /// <param name="prov"></param>
        /// <param name="simpe_pkg"></param>
        public void Execute(IProviderRegistry prov, SimPe.Interfaces.Files.IPackageFile simpe_pkg, ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd)
        {
            this.pfd      = pfd;
            this.open_pkg = simpe_pkg;
            WaitingScreen.Wait();
            try
            {
                llopen.Enabled = false;
                SimPe.Interfaces.Files.IPackageFile orgpkg = simpe_pkg;

                DateTime start = DateTime.Now;
                FileTable.FileIndex.Load();
                SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex = FileTable.FileIndex.Clone();
                fileindex.AddIndexFromPackage(simpe_pkg);

                SimPe.Interfaces.Scenegraph.IScenegraphFileIndex oldfileindex = FileTable.FileIndex;
                FileTable.FileIndex = fileindex;

                //find txtr File

                /*WaitingScreen.UpdateMessage("Collecting Global Files");
                 * string[] modelnames = Scenegraph.FindModelNames(simpe_pkg);
                 * try
                 * {
                 *  ObjectCloner oc = new ObjectCloner();
                 *  oc.RcolModelClone(modelnames, false, false);
                 *  simpe_pkg = oc.Package;
                 * }
                 * catch (ScenegraphException) {}*/

                FileTable.FileIndex = oldfileindex;


                gb.BuildGraph(simpe_pkg, fileindex);
                gb.FindUnused(orgpkg);

                WaitingScreen.Stop();
                TimeSpan runtime = DateTime.Now.Subtract(start);
                if (Helper.WindowsRegistry.HiddenMode)
                {
                    Text = "Runtime: " + runtime.TotalSeconds + " sek. = " + runtime.TotalMinutes + " min.";
                }
                RemoteControl.ShowSubForm(this);

                pfd = this.pfd;
            }
#if !DEBUG
            catch (Exception ex) { Helper.ExceptionMessage("", ex); }
#endif
            finally { WaitingScreen.Stop(); }
        }
Esempio n. 14
0
        private void NgbBackup(object sender, System.EventArgs e)
        {
            if (lv.SelectedItems.Count <= 0)
            {
                return;
            }

            SimPe.Packages.StreamFactory.CloseAll();
            string path  = System.IO.Path.GetDirectoryName(lv.SelectedItems[0].SubItems[1].Text).Trim();
            string lable = lv.SelectedItems[0].SubItems[3].Text;

            //if a File in the current Neighborhood is opened - close it!
            CloseIfOpened(path);

            this.Cursor = Cursors.WaitCursor;
            WaitingScreen.Wait();
            try
            {
                //create a Backup Folder
                string name = System.IO.Path.GetFileName(path);
                if (lable != "")
                {
                    name = lable + "_" + name;
                }
                long grp = PathProvider.Global.SaveGamePathProvidedByGroup(path);
                if (grp > 1)
                {
                    name = grp.ToString() + "_" + name;
                }

                string backuppath = System.IO.Path.Combine(PathProvider.Global.BackupFolder, name);
                string subname    = DateTime.Now.ToString();
                backuppath = System.IO.Path.Combine(backuppath, subname.Replace("\\", "-").Replace("/", "-").Replace(":", "-"));
                if (!System.IO.Directory.Exists(backuppath))
                {
                    System.IO.Directory.CreateDirectory(backuppath);
                }

                Helper.CopyDirectory(path, backuppath, true);
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                WaitingScreen.Stop(this);
                this.Cursor = Cursors.Default;
            }
        }
Esempio n. 15
0
 public void JumpBeforBrianHit()
 {
     MessageSystemPlayingScene.IsJump = true;
     PlayerZone.SetNoneRigid();
     MessageSystemGameBlock.SetPlayingConstraints();
     if (!MessageSystemPlayingScene.exitFromPingPong)
     {
         MessageSystemPlayingScene.exitFromPingPong = true;
     }
     if (!MessageSystemPlayingScene.IsDead)
     {
         WaitingScreen.wait(MessageSystemPlayingScene.DisableCollider());
         MessageSystemPlayingScene.Player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 9), ForceMode2D.Impulse);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Load all MATDs referenced by the passed MMATs
 /// </summary>
 /// <param name="pfds">List of MMAT Descriptors from the current Package</param>
 protected void LoadReferencedMATDs(Interfaces.Files.IPackedFileDescriptor[] pfds)
 {
     //WaitingScreen.Wait();
     if (WaitingScreen.Running)
     {
         WaitingScreen.UpdateMessage("Loading Material Overrides");
     }
     foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
     {
         SimPe.PackedFiles.Wrapper.Cpf mmat = new SimPe.PackedFiles.Wrapper.Cpf();
         mmat.ProcessData(pfd, package);
         AddMATD(mmat);
     }
     //WaitingScreen.Stop();
 }
Esempio n. 17
0
        /// <summary>
        /// Create a new Color Options package
        /// </summary>
        /// <param name="newpkg">The Package the color Option should be added to</param>
        /// <param name="ask">if ask is true, a Dialog will be displayed that lets the
        /// user decide which Subsets to recolor</param>
        public void Create(IPackageFile newpkg)
        {
            WaitingScreen.Wait();
            try
            {
                //this.newpkg = newpkg;

                WaitingScreen.UpdateMessage("Loading available Color Options");
                Hashtable fullmap        = Scenegraph.GetMMATMap(package);
                Hashtable map            = fullmap;
                ArrayList allowedSubsets = Scenegraph.GetRecolorableSubsets(package);

                //Check if the User can select a Subset
                bool userselect = false;
                if (map.Count > 1)
                {
                    userselect = true;
                }
                else
                {
                    if (map.Count == 1)
                    {
                        foreach (string s in map.Keys)
                        {
                            Hashtable ht = (Hashtable)map[s];
                            if (ht.Count > 1)
                            {
                                userselect = true;
                            }
                        }
                    }
                }

                //let the user Select now
                if (userselect)
                {
                    map = SubsetSelectForm.Execute(map, allowedSubsets);
                }



                ProcessMmatMap(newpkg, map, fullmap);
            }
            finally
            {
                WaitingScreen.Stop();
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Loads the ModelNames of the Objects referenced in all tsMaterialsMeshName Block
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="delete">true, if the tsMaterialsMeshName Blocks should get cleared</param>
        /// <returns>A List of Modelnames</returns>
        public static string[] LoadParentModelNames(SimPe.Interfaces.Files.IPackageFile pkg, bool delete)
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Loading Parent Modelnames");
            }
            ArrayList list = new ArrayList();

            Interfaces.Files.IPackedFileDescriptor[] pfds = pkg.FindFiles(Data.MetaData.GMND);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                Rcol rcol = new GenericRcol(null, false);
                rcol.ProcessData(pfd, pkg);

                foreach (IRcolBlock irb in rcol.Blocks)
                {
                    if (irb.BlockName.Trim().ToLower() == "cdatalistextension")
                    {
                        DataListExtension dle = (DataListExtension)irb;
                        if (dle.Extension.VarName.Trim().ToLower() == "tsmaterialsmeshname")
                        {
                            foreach (ExtensionItem ei in dle.Extension.Items)
                            {
                                string mname = ei.String.Trim().ToLower();
                                if (mname.EndsWith("_cres"))
                                {
                                    mname += "_cres";
                                }

                                if (!list.Contains(mname))
                                {
                                    list.Add(mname);
                                }
                            }

                            dle.Extension.Items = new ExtensionItem[0];
                            rcol.SynchronizeUserData();
                            break;
                        }
                    }
                }
            }

            string[] ret = new string[list.Count];
            list.CopyTo(ret);

            return(ret);
        }
Esempio n. 19
0
    void Awake()
    {
        if( mInstance != null )
        {
            Debug.LogError( string.Format( "Only one instance of WaitingScreen allowed! Destroying:" + gameObject.name +", Other:" + mInstance.gameObject.name ) );
            return;
        }

        mInstance = this;

        if( NetworkAgent.GetIsHost() )
            HighlightHost();
        else
            HighlightJoin();

        StartCoroutine( "WaitForRoom" );
    }
Esempio n. 20
0
        protected static SimPe.Packages.GeneratableFile ReColorXObject(CloneSettings.BaseResourceType br, SimPe.Packages.GeneratableFile pkg, Interfaces.Files.IPackedFileDescriptor pfd, uint localgroup, ObjectWorkshopSettings settings)
        {
            settings.KeepOriginalMesh = true;
            SimPe.Packages.GeneratableFile package = pkg;
            // we need packages in the Gmaes and the Download Folder

            if (((!System.IO.File.Exists(ScenegraphHelper.GMND_PACKAGE)) || (!System.IO.File.Exists(ScenegraphHelper.MMAT_PACKAGE))) && (settings is OWCloneSettings))
            {
                if (Message.Show(Localization.Manager.GetString("OW_Warning"), "Warning", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return(package);
                }
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = ExtensionProvider.BuildFilterString(
                new SimPe.ExtensionType[] {
                SimPe.ExtensionType.Package,
                SimPe.ExtensionType.AllFiles
            }
                );
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return(package);
            }

            //create a Cloned Object to get all needed Files for the Process
            WaitingScreen.Wait();
            try
            {
                WaitingScreen.UpdateMessage("Collecting needed Files");

                if ((package == null) && (pfd != null))
                {
                    package = RecolorClone(br, package, pfd, localgroup, settings, false);
                }
            }
            finally { WaitingScreen.Stop(); }

            package.FileName = sfd.FileName;
            package.Save();

            return(package);
        }
Esempio n. 21
0
        /// <summary>
        /// Setup the Form
        /// </summary>
        /// <param name="map">The subset map</param>
        /// <param name="subsets">the subsets you want to present</param>
        /// <returns>Returns a New Instance of the selection Form</returns>
        public static SubsetSelectForm Prepare(Hashtable map, ArrayList subsets)
        {
            SubsetSelectForm ssf = new SubsetSelectForm();

            ssf.listviews = new ArrayList();
            ssf.txmtnames = new Hashtable();
            WaitingScreen.Wait();
            try
            {
                WaitingScreen.UpdateMessage("Show Subset Selection");
                ssf.button1.Enabled = false;

                int top = 0;
                foreach (string subset in map.Keys)
                {
                    if (!subsets.Contains(subset))
                    {
                        continue;
                    }

                    ListView  lv       = ssf.AddSelection(ssf, subset, ref top);
                    Hashtable families = (Hashtable)map[subset];
                    foreach (string family in families.Keys)
                    {
                        ArrayList mmats = (ArrayList)families[family];
                        mmats.Sort(new MmatListCompare());
                        ssf.AddItem(lv, mmats);
                    }

                    if (lv.Items.Count > 0)
                    {
                        lv.Items[0].Selected = true;
                    }
                }
            }
            finally
            {
                WaitingScreen.Stop();
            }

            return(ssf);
        }
Esempio n. 22
0
        /// <summary>
        /// Returns the Thumbnail of an Object
        /// </summary>
        /// <param name="group"></param>
        /// <param name="modelname"></param>
        /// <returns>The Thumbnail</returns>
        public static Image GetThumbnail(string message, uint[] types, uint group, uint inst, SimPe.Packages.File thumbs)
        {
            /*ArrayList types = new ArrayList();
             * types.Add(0xAC2950C1); // Objects
             * types.Add(0xEC3126C4); // Terrain
             * types.Add(0xCC48C51F); //chimney
             * types.Add(0x2C30E040); //fence Arch
             * types.Add(0xCC30CDF8); //fences
             * types.Add(0x8C311262); //floors
             * types.Add(0x2C43CBD4); //foundtaion / pools
             * types.Add(0xCC44B5EC); //modular Stairs
             * types.Add(0xCC489E46); //roof
             * types.Add(0x8C31125E); //wall*/

            foreach (uint type in types)
            {
                //0x6C2A22C3
                Interfaces.Files.IPackedFileDescriptor[] pfds = thumbs.FindFile(type, group, inst);
                if (pfds.Length == 0)
                {
                    pfds = thumbs.FindFile(type, 0, inst);
                }
                if (pfds.Length > 0)
                {
                    Interfaces.Files.IPackedFileDescriptor pfd = pfds[0];
                    try
                    {
                        SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture();
                        pic.ProcessData(pfd, thumbs);
                        Bitmap bm = (Bitmap)ImageLoader.Preview(pic.Image, WaitingScreen.ImageSize);
                        if (WaitingScreen.Running)
                        {
                            WaitingScreen.Update(bm, message);
                        }
                        return(pic.Image);
                    }
                    catch (Exception) { }
                }
            }
            return(null);
        }
Esempio n. 23
0
        /// <summary>
        /// Remove some unreferenced and useless Files
        /// </summary>
        public void CleanUp()
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Cleaning up");
            }
            Interfaces.Files.IPackedFileDescriptor[] mpfds = package.FindFiles(Data.MetaData.MMAT);             //MMAT
            ArrayList mmats = new ArrayList();

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in mpfds)
            {
                SimPe.PackedFiles.Wrapper.Cpf mmat = new SimPe.PackedFiles.Wrapper.Cpf();
                mmat.ProcessData(pfd, package);

                string content = Scenegraph.MmatContent(mmat);

                if (!mmats.Contains(content))
                {
                    string txmtname = (string)Hashes.StripHashFromName(mmat.GetSaveItem("name").StringValue.Trim().ToLower()) + "_txmt";
                    string cresname = (string)Hashes.StripHashFromName(mmat.GetSaveItem("modelName").StringValue.Trim().ToLower());

                    if (package.FindFile(Hashes.StripHashFromName(txmtname), 0x49596978).Length < 0)
                    {
                        pfd.MarkForDelete = true;
                    }
                    if (package.FindFile(Hashes.StripHashFromName(cresname), 0xE519C933).Length < 0)
                    {
                        pfd.MarkForDelete = true;
                    }

                    if (!pfd.MarkForDelete)
                    {
                        mmats.Add(content);
                    }
                }
                else
                {
                    pfd.MarkForDelete = true;
                }
            }
        }
 public static void Jump()
 {
     if (!StopCollider.IsCollision)
     {
         float powerJump = 10;
         isJump = true;
         PlayerZone.SetNoneRigid();
         MessageSystemGameBlock.SetPlayingConstraints();
         if (!exitFromPingPong)
         {
             exitFromPingPong = true;
             player.tag       = "Player";
         }
         if (!isDead)
         {
             WaitingScreen.wait(DisableCollider());
             player.GetComponent <Rigidbody2D>().AddForce(new Vector3(0, powerJump, 0), ForceMode2D.Impulse);
             player.GetComponent <Animator>().SetBool("IsJumpUp", true);
         }
     }
 }
Esempio n. 25
0
        /// <summary>
        /// Adds the MMAT Files specified in the map to the new package
        /// </summary>
        /// <param name="newpkg"></param>
        /// <param name="map">Contains the MMATs that should be added</param>
        /// <param name="fullmap">Contains a List of all available MMATs</param>
        public void ProcessMmatMap(IPackageFile newpkg, Hashtable map, Hashtable fullmap)
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Loading Slave Subsets");
            }
            AddSlavesSubsets(map, fullmap);
            Hashtable slaves = Scenegraph.GetSlaveSubsets(package);

            uint   inst   = 0x6000;
            string unique = RenameForm.GetUniqueName(true);

            foreach (Hashtable ht in map.Values)
            {
                foreach (ArrayList list in ht.Values)
                {
                    string family = System.Guid.NewGuid().ToString();
                    if (unique == null)
                    {
                        unique = family;
                    }

                    foreach (SimPe.Plugin.MmatWrapper mmat in list)
                    {
                        mmat.FileDescriptor          = Scenegraph.Clone(mmat.FileDescriptor);
                        mmat.FileDescriptor.Instance = inst++;
                        mmat.FileDescriptor.Group    = Data.MetaData.LOCAL_GROUP;
                        mmat.Family          = family;
                        mmat.DefaultMaterial = false;

                        GenericRcol txmt = mmat.TXMT;
                        GenericRcol txtr = mmat.TXTR;
                        this.AddTxmt(newpkg, mmat, txmt, txtr, unique, slaves);

                        mmat.SynchronizeUserData();
                        newpkg.Add(mmat.FileDescriptor);
                    }
                }
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Make sure the fixes for OBJd Resources are considered
        /// </summary>
        /// <remarks>
        /// Currently this implements the Fixes needed for Rugs
        /// </remarks>
        void FixOBJd()
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Updating Object Descriuptions");
            }
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(Data.MetaData.OBJD_FILE);                 //OBJd

            bool updaterugs = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
                objd.ProcessData(pfd, package);

                //is one of the objd's a rug?
                if (objd.FunctionSubSort == SimPe.Data.ObjFunctionSubSort.Decorative_Rugs)
                {
                    updaterugs = true;
                    break;
                }
            }

            //found at least one OBJd describing a Rug
            if (updaterugs)
            {
                foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
                    objd.ProcessData(pfd, package);

                    //make sure the Type of a Rug is not a Tile, but Normal
                    if (objd.Type == SimPe.Data.ObjectTypes.Tiles)
                    {
                        objd.Type = SimPe.Data.ObjectTypes.Normal;
                        objd.SynchronizeUserData(true, true);
                    }
                }
            }
        }
Esempio n. 27
0
        protected void FillList()
        {
            this.Cursor = Cursors.WaitCursor;
            WaitingScreen.Wait();
            ilist.Images.Clear();
            this.iListSmall.Images.Clear();
            lv.BeginUpdate();
            lv.Items.Clear();
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(Data.MetaData.SIM_DESCRIPTION_FILE);
            try
            {
                foreach (Interfaces.Files.IPackedFileDescriptor spfd in pfds)
                {
                    Application.DoEvents();
                    PackedFiles.Wrapper.ExtSDesc sdesc = new SimPe.PackedFiles.Wrapper.ExtSDesc();
                    sdesc.ProcessData(spfd, package);

                    bool doAdd = false;
                    doAdd |= (this.cbNpc.Checked && realIsNPC(sdesc));
                    doAdd |= (this.cbTownie.Checked && realIsTownie(sdesc));
                    doAdd |= (this.ckbPlayable.Checked && realIsPlayable(sdesc));
                    doAdd |= (this.ckbUnEditable.Checked && realIsUneditable(sdesc));

                    //WaitingScreen.UpdateImage(ImageLoader.Preview(sdesc.Image, new Size(64, 64)));
                    if (doAdd)
                    {
                        AddSim(sdesc);
                    }
                }

                sorter.Sorting = lv.Sorting;
                lv.Sort();
            }
            finally
            {
                lv.EndUpdate();
                WaitingScreen.Stop(this);
                this.Cursor = Cursors.Default;
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //graphics.ToggleFullScreen();

            screenState = ScreenState.Title;

            gameScreen     = new GameScreen();
            mainMenuScreen = new MainMenuScreen();
            titleScreen    = new TitleScreen();
            gameOverScreen = new GameOverScreen();
            //playerSelectScreen = new PlayerSelectScreen();
            oneplayerSelectScreen = new OnePlayerSelectScreen();
            twoplayerSelectScreen = new TwoPlayerSelectScreen();
            onlineOptionsScreen   = new OnlineOptionsScreen();
            onlineJoinScreen      = new OnlineJoinScreen();
            optionsScreen         = new OptionsScreen();
            editControls          = new EditControlsScreen();
            pauseScreen           = new PauseScreen();
            errorScreen           = new ErrorScreen();
            gameModeScreen        = new GameModeScreen();
            keyboardScreen        = new KeyboardScreen();
            waitingScreen         = new WaitingScreen();



            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;
            graphics.ApplyChanges();


            Global.Scale = new Vector2(GraphicsDevice.Viewport.Width / 1920f);

            InputManager.Update();
            Global.UsingKeyboard = !InputManager.PressedKeysPlayer1.IsConnected;
            IsMouseVisible       = true;
            base.Initialize();
        }
Esempio n. 29
0
        public Interfaces.Plugin.IToolResult ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package)
        {
            FixObject fo = new FixObject(package, FixVersion.UniversityReady, false);

            try
            {
                System.Collections.Hashtable map = fo.GetNameMap(false);
                if (map == null)
                {
                    return(new ToolResult(false, false));
                }

                WaitingScreen.Wait();

                fo.Fix(map, false);
                fo.CleanUp();
                fo.FixGroup();
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                WaitingScreen.Stop();
            }

            if (Helper.StartedGui != Executable.Classic)
            {
                return(new ToolResult(false, false));
            }
            else
            {
                return(new ToolResult(false, true));
            }
        }
Esempio n. 30
0
 void Start()
 {
     explosionPrefab = Explosion;
     info = GetComponent<WaitingScreen>();
     info.enabled = false;
     pause = GetComponent<MenuKeysController>();
     pause.enabled = false;
     hud = GetComponent<GameHUD>();
     hud.enabled = false;
     end = GetComponent<EndGame>();
     end.enabled = false;
     alpha = GetComponent<AlphaBackground>();
     alpha.enabled = false;
 }
Esempio n. 31
0
        public void ExtractAllFiles(string selpath, SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds, SimPe.Packages.ExtractableFile package)
        {
            int    excount   = 0;
            int    filecount = 0;
            string xml       = "";
            bool   run       = WaitingScreen.Running;

            if (!run)
            {
                WaitingScreen.Wait();
            }
            try
            {
                xml += "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + Helper.lbr;
                xml += "<package type=\"" + ((uint)package.Header.IndexType).ToString() + "\">" + Helper.lbr;
                for (int i = 0; i < pfds.Length; i++)
                {
                    System.Windows.Forms.Application.DoEvents();
                    Packages.PackedFileDescriptor fii = (Packages.PackedFileDescriptor)pfds[i];
                    Data.TypeAlias a = fii.TypeName;

                    fii.Path = null;
                    string path = System.IO.Path.Combine(selpath, fii.Path);

                    fii.Filename = null;
                    string name = System.IO.Path.Combine(path, fii.Filename);

                    try
                    {
                        if (!System.IO.Directory.Exists(path))
                        {
                            System.IO.Directory.CreateDirectory(path);
                        }

                        //make sure the sub xmls don't have a Filename
                        fii.Path = "";
                        package.SavePackedFile(name, null, fii, true);
                        fii.Path = null;

                        xml += fii.GenerateXmlMetaInfo();

                        filecount++;
                    }
                    catch (Exception ex)
                    {
                        excount++;
                        Helper.ExceptionMessage(Localization.Manager.GetString("errwritingfile") + " " + name, ex);
                        if (excount >= 5)
                        {
                            if (Message.Show(Localization.Manager.GetString("ask000"), Localization.Manager.GetString("proceed"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                            {
                                i = pfds.Length;
                            }
                        }
                    }
                }                //for i
                xml += "</package>" + Helper.lbr;

                System.IO.TextWriter tw = System.IO.File.CreateText(System.IO.Path.Combine(selpath, "package.xml"));
                try
                {
                    tw.Write(xml);
                }
                catch (Exception ex)
                {
                    Helper.ExceptionMessage(Localization.Manager.GetString("err001"), ex);
                }
                finally
                {
                    tw.Close();
                    tw.Dispose();
                    tw = null;
                }
            }
            finally
            {
                if (!run)
                {
                    WaitingScreen.Stop();
                }
            }

            Message.Show(Localization.Manager.GetString("nfo000").Replace("{0}", filecount.ToString()), "Info", System.Windows.Forms.MessageBoxButtons.OK);
        }
Esempio n. 32
0
        /// <summary>
        /// this Operation is fixing selected Packages that wer marked as problematic
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FixCompression(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (selection == null)
            {
                return;
            }

            WaitingScreen.Wait();
            bool chg = false;

            try
            {
                foreach (ScannerItem si in selection)
                {
                    if (si.PackageCacheItem.Thumbnail != null)
                    {
                        WaitingScreen.Update(si.PackageCacheItem.Thumbnail, si.FileName);
                    }
                    else
                    {
                        WaitingScreen.UpdateMessage(si.FileName);
                    }

                    SimPe.Cache.PackageState ps = si.PackageCacheItem.FindState(this.Uid, true);
                    if ((ps.State != TriState.Null) && (ps.Data.Length > 0))
                    {
                        if ((HealthState)ps.Data[0] != HealthState.Ok)
                        {
                            ps.State   = TriState.True;
                            ps.Data[0] = (uint)HealthState.Ok;
                            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in si.Package.Index)
                            {
                                SimPe.Interfaces.Files.IPackedFile file = si.Package.Read(pfd);
                                pfd.UserData          = file.UncompressedData;
                                pfd.MarkForReCompress = (file.IsCompressed || Data.MetaData.CompressionCandidates.Contains(pfd.Type));

                                if (pfd.Type == Data.MetaData.OBJD_FILE)
                                {
                                    SimPe.PackedFiles.Wrapper.ExtObjd objd = new ExtObjd();
                                    objd.ProcessData(pfd, si.Package);

                                    if (objd.Ok != SimPe.PackedFiles.Wrapper.ObjdHealth.Ok)
                                    {
                                        objd.SynchronizeUserData();
                                        objd.ProcessData(pfd, si.Package);

                                        if (objd.Ok != ObjdHealth.Ok)
                                        {
                                            ps.State   = TriState.False;
                                            ps.Data[0] = (uint)HealthState.NonDefaultObjd;
                                            if (objd.Ok == SimPe.PackedFiles.Wrapper.ObjdHealth.UnmatchingFilenames && Helper.WindowsRegistry.HiddenMode)
                                            {
                                                ps.Data[0] = (uint)HealthState.FaultyNamedObjd;
                                            }
                                            if (objd.Ok == ObjdHealth.OverLength)
                                            {
                                                ps.Data[0] = (uint)HealthState.FaultySizedObjd;
                                            }
                                        }
                                    }
                                }
                            }

                            si.Package.Save();
                            chg = true;
                            si.ListViewItem.ForeColor = System.Drawing.Color.Black;
                            this.ScanPackage(si, ps, si.ListViewItem);
                        }
                    }
                }

                if (chg && this.CallbackFinish != null)
                {
                    this.CallbackFinish(false, false);
                }
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                WaitingScreen.Stop();
            }
        }