Skip to content

Instantly share code, notes, and snippets.

@ArcCosine
Created May 21, 2014 07:00
Show Gist options
  • Save ArcCosine/887c5165fe947021ea4d to your computer and use it in GitHub Desktop.
Save ArcCosine/887c5165fe947021ea4d to your computer and use it in GitHub Desktop.
// 変更前
var domain = 'http://domyojikarin.com/dmjcookie/img/';
var hash = {'perfectCookie.png': 'perfectDmj.png'
, 'cookieShower1.png': 'dmjShower1.png'
, 'cookieShower2.png': 'dmjShower2.png'
, 'cookieShower3.png': 'dmjShower3.png'
};
var as = Game.Loader.assets;
for (var i in as){
var v = as[i];
var a = v.alt;
if (a in hash) {
v.src = domain + hash[a];
}
}
//変更後
(function(){
var as = Game.Loader.assets,k,v,m;
for(k in as){
v=as[k];
if(m=/(pe.*t|S.*\d)/.exec(v.alt)){
v.src='http://domyojikarin.com/dmjcookie/img/'+(m[1][0]=='p'?m[1]+'Dmj':'dmj'+m[1])+'.png';
}
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment