Changeset 36087

Show
Ignore:
Timestamp:
12/07/09 18:34:45 (3 years ago)
Author:
hoge1e3
Message:
 
Location:
lang/haxe/Tonyu2
Files:
4 added
4 modified

Legend:

Unmodified
Added
Removed
  • lang/haxe/Tonyu2/Projects/toste/Test.tonyu

    r36072 r36087  
    44y=200; 
    55while (x<200) { 
    6   x=x+1; 
     6  x=x+3; 
    77  y=y-rnd(5); 
    88  y=y+2; 
    99  update(); 
    1010} 
     11new Teki{x:x, y:y}; 
    1112while (y>0) { 
    1213  y=y-rnd(6);y=y+2; 
  • lang/haxe/Tonyu2/Projects/toste/haxe/Test.hx

    r36072 r36087  
    1414        } 
    1515      case 2: 
    16         x=(x+1); 
     16        x=(x+3); 
    1717        y=(y-rnd(5)); 
    1818        y=(y+2); 
     
    2222        state=1; 
    2323      case 3: 
     24        (function (y,x) {var _res=new Teki();_res.y=y;_res.x=x;return _res;})(y,x); 
    2425        state=5; 
    2526      case 5: 
  • lang/haxe/Tonyu2/htdocs/Project.class.js

    r36072 r36087  
    11function procAjax(p) { 
    2         if (p==null) return function(){}; 
     2        if (p==null) return NOP; 
    33   return function (res) { 
    44     try { 
     
    1313        return ["div",{style:pos(x,y)},cont]; 
    1414} 
     15function NOP(){}; 
    1516var curProject; 
    1617shortcut.add("Ctrl+W",function(){curProject.saveTonyuSource()}); 
     
    6970                        }); 
    7071                 function showResponse(res) { 
    71                            t.fileList.set(); 
     72                           t.fileList.set(dButton(function (e) { 
     73                                        var cl=prompt('Class Name',''); 
     74                                        t.createTonyuSource(e,cl); 
     75                                },"New")); 
    7276                       res.split(/\n/).each(function (r) { 
    7377                               t.fileList.add(["div", 
    7478                                        ["a",{onclick: function () { 
    75                                           t.openTonyuSource(r); 
     79                                          t.openTonyuSourceAfterSave(NOP,r); 
    7680                                                }},r]]); 
    7781                           }); 
    7882                 } 
    7983        }, 
    80         openTonyuSource: function (name) { 
     84        openTonyuSource: function (next, name) { 
    8185                var t=this;      
    8286                new Ajax.Request( 
     
    9195                        t.currentSourceName=name; 
    9296                        t.savedCont=res; 
     97                        next(res); 
    9398                } 
     99        }, 
     100        openTonyuSourceAfterSave: function (next,name) { 
     101                var t=this; 
     102                if (t.editorContentModified()) { 
     103                //alert(">"+name); 
     104                        t.saveTonyuSource(load); 
     105                } else { 
     106                //alert("<"+name); 
     107                        load(); 
     108                } 
     109                function load(){t.openTonyuSource(next,name)} 
    94110        }, 
    95111        updateModifiedIndicator: function () { 
     
    101117                return t.savedCont!=t.editor.getAttr("value"); 
    102118        }, 
    103         saveTonyuSourceAs: function (cl,cont,next) { 
     119        createTonyuSource: function (next, cl) { 
     120                var t=this 
     121                t.saveTonyuSourceAs(function(){t.listTonyuSource()}, cl,  
     122                  "extends tonyu.Actor;\n\n"); 
     123        }, 
     124        saveTonyuSourceAs: function (next, cl,cont) { 
    104125                var t=this;      
    105126                new Ajax.Request( 
     
    121142                var t=this;      
    122143                //alert(t.currentSourceName); 
    123                 if (t.currentSourceName == null) return; 
    124                 t.saveTonyuSourceAs( t.currentSourceName, t.editor.getAttr("value"),next ); 
     144                if (t.currentSourceName == null) return next(); 
     145                t.saveTonyuSourceAs(next, t.currentSourceName, t.editor.getAttr("value") ); 
    125146        }, 
    126147        make: function (next) {