MoltenMercury/MoltenChara.cs

(开头部分) 71KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

#define SAFE_UPDATE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Linq;
using MoltenMercury.DataModel;
using MoltenMercury.ImageProcessing;
using System.Xml;
using libWyvernzora.IO;
using libWyvernzora.IO.Packaging;
using MoltenMercury.Localization;

/* ============================================================================
 * MoltenChara.cs
 * ----------------------------------------------------------------------------
 * 2012 (C) Jieni Luchijinzhou a.k.a Aragorn Wyvernzora
 * 
 * This file is a part of the Molten Mercury Project
 * This is the main form of the Molten Chara anime character creator.
 * 
 * Notes:
 * Originally I had a method named UpdatePreview which created the composite
 * bitmap from selected character parts. It was tied to various control events
 * so that whenever a value is changed preview image can be updated accordingly.
 * However, since each change fires its own update request, I got over 100 updates
 * each time the program starts (due to initialization of controls) and even more
 * when values of some controls change (because changing values of one control may
 * trigger changes in other controls). Considering that updating preview is the most
 * expensive operation in this program, I created a few workarounds to address the
 * problem:
 * 
 * 1)   I created CharaBlocker class which acts as a lock. When an instance is created
 *      it locks the MoltenChara form in a way that attempts to update the preview will
 *      be blocked as long as the lock is in place. When CharaBlocker instance is disposed
 *      it will unlock the MoltenChara form and updates of the preview will be allowed.
 *      
 * 2)   I moved preview updating operations to a background thread so that it doesn't
 *      block UI thread even if updates occur frequently and take longer than expected.
 *      When an update is requested when there is already a running update, there is a 
 *      flag that will be checked upon completion of the running update. If the flag is
 *      true, another update will be launched immediately.
 *      
 */

namespace MoltenMercury
{
    public partial class MoltenChara : Form
    {
        #region Internal Data Types

        /// <summary>
        /// This is a utility class used for blocking UpdateCharacterPreviewAsync
        /// from being called.
        /// </summary>
        /// <remarks>
后面还有 1707 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。