Example #1
0
        private static Tex LoadTex(byte[] bytes, string name)
        {
            if (Program.Closing)
            {
                Environment.Exit(0);
            }

            Console.WriteLine(Resources.DecompilingName, name);

            try
            {
                var tex = TexLoader.LoadTex(bytes, 1);

                if (_options.DebugInfo)
                {
                    tex.DebugInfo();
                }

                return(tex);
            }
            catch (Exception e)
            {
                Console.WriteLine(Resources.FailedToDecompile);
                Console.WriteLine(e);
            }

            return(null);
        }
 void OnEnable()
 {
     this.setter = target as TexSetter;
     this.loader = setter.GetComponent <TexLoader>();
     if (setter.textures.IsEmpty())
     {
         CopyTexture(setter, loader);
     }
 }
 public static void CopyTexture(TexSetter s, TexLoader l)
 {
     if (l.Target.mainTexture != null && AssetBundlePath.inst.IsCdnAsset(l.Target.mainTexture))
     {
         AssetRef r = new AssetRef();
         r.cdn = true;
         r.SetPath(l.Target.mainTexture);
         s.textures.Add(r);
         EditorUtil.SetDirty(s);
     }
 }
Example #4
0
    /// <summary>
    /// sets the board's size and texture according to the stored data
    /// </summary>
    public static void SetupBoardDetails()
    {
        Rules curRules = GameController.instance.curData.rules;

        instance.ground.localScale = new Vector3(curRules.boardDimensions.x, curRules.boardDimensions.y, 1);
        if (!string.IsNullOrEmpty(curRules.boardTexturePath))
        {
            Texture loadedTex = TexLoader.GetOrLoadTex(curRules.boardTexturePath);
            if (loadedTex)
            {
                instance.ground.GetComponent <Renderer>().sharedMaterial.mainTexture = loadedTex;
            }
        }
    }
 public static void SetIfCdn(UITexture tex)
 {
     if (tex == null || tex.mainTexture == null || tex.GetComponent <TexSetter>() != null)
     {
         return;
     }
     /// Add TexSetter if texture is from CDN
     if (AssetBundlePath.inst.IsCdnAsset(tex.mainTexture))
     {
         TexLoader l = tex.GetComponentEx <TexLoader>();
         TexSetter s = l.GetComponentEx <TexSetter>();
         TexSetterInspector.CopyTexture(s, l);
     }
 }
Example #6
0
 public override void Cleanup()
 {
     WorldVisualFeedbacks.instance.PoolAllOrderFeedbacks();
     World.CleanZonesContainer();
     World.CleanZoneLinks();
     World.CleanCmders();
     World.CleanMCaravans();
     TransformTweener.instance.StopAllTweens();
     World.ToggleWorldDisplay(false);
     World.instance.garrDescOnHoverScript.enabled = false;
     StopAllPhaseMans();
     GameInterface.instance.DisableAndStoreAllOpenOverlayPanels();
     GameController.instance.facMatsHandler.PurgeFactionColorsDict();
     TexLoader.PurgeTexDict();
     curPlayingFaction = null;
 }
Example #7
0
        protected void Test(string name, bool validateBytes = false, Action <Tex, byte[]> validateTex = null)
        {
            var texture = TexLoader.LoadTex(LoadTestFile(name));
            var bytes   = texture.Decompile();

            validateTex?.Invoke(texture, bytes);

            if (validateBytes)
            {
                ValidateBytes(bytes, name);
            }
            else
            {
                SaveValidatedBytes(bytes, name);
                SaveOutput(texture, name);
            }
        }
Example #8
0
 public override void Cleanup()
 {
     if (World.instance.zoneLinkerScript.enabled)
     {
         World.instance.zoneLinkerScript.DoneLinking();
     }
     if (World.instance.zoneMoverScript.enabled)
     {
         World.instance.zoneMoverScript.DoneMoving();
     }
     World.CleanZonesContainer();
     World.CleanZoneLinks();
     World.CleanMCaravans();
     World.ToggleWorldDisplay(false);
     World.instance.zoneEditOnClickScript.enabled = false;
     World.instance.garrDescOnHoverScript.enabled = false;
     tempSaveOptionsPanel.gameObject.SetActive(false);
     GameController.instance.facMatsHandler.PurgeFactionColorsDict();
     TexLoader.PurgeTexDict();
 }