Project

General

Profile

« Previous | Next » 

Revision 8becce57

Added by Leszek Koltunski about 4 years ago

Major progress with Prretty Patterns - hopefully only initializing the Object remains!

View differences:

src/main/java/org/distorted/uistate/RubikStatePattern.java
34 34
import org.distorted.dialog.RubikDialogPattern;
35 35
import org.distorted.magic.R;
36 36
import org.distorted.magic.RubikActivity;
37
import org.distorted.object.RubikObject;
37
import org.distorted.magic.RubikPostRender;
38 38
import org.distorted.object.RubikObjectList;
39 39
import org.distorted.patterns.RubikPattern;
40 40

  
......
49 49
  private Button mBackButton;
50 50
  private ImageButton mPrevButton, mNextButton;
51 51
  private TextView mMovesText;
52
  private int mNumMoves, mCurrMove;
52
  private int mNumMoves;
53 53
  private int mSizeIndex, mCategory, mPattern;
54 54

  
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
......
192 192
      @Override
193 193
      public void onClick(View v)
194 194
        {
195
        if( --mCurrMove< 0 ) mCurrMove=mNumMoves;
196

  
197
        mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
198
        RubikObject object = act.getObject();
199
        RubikPattern.getInstance().backMove( object, mSizeIndex, mCategory, mPattern);
195
        RubikPattern pattern = RubikPattern.getInstance();
196
        RubikPostRender post = act.getPostRender();
197
        pattern.backMove( post, mSizeIndex, mCategory, mPattern);
198
        int currMove = pattern.getCurMove(mSizeIndex, mCategory, mPattern);
199
        mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves));
200 200
        }
201 201
      });
202 202
    }
......
217 217
      @Override
218 218
      public void onClick(View v)
219 219
        {
220
        if( ++mCurrMove> mNumMoves ) mCurrMove=0;
221

  
222
        mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
223
        RubikObject object = act.getObject();
224
        RubikPattern.getInstance().makeMove( object, mSizeIndex, mCategory, mPattern);
220
        RubikPattern pattern = RubikPattern.getInstance();
221
        RubikPostRender post = act.getPostRender();
222
        pattern.makeMove( post, mSizeIndex, mCategory, mPattern);
223
        int currMove = pattern.getCurMove(mSizeIndex, mCategory, mPattern);
224
        mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves));
225 225
        }
226 226
      });
227 227
    }
......
239 239
    mMovesText.setPadding(padding,0,padding,0);
240 240
    mMovesText.setGravity(Gravity.CENTER);
241 241

  
242
    mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
242
    RubikPattern pattern = RubikPattern.getInstance();
243
    int currMove = pattern.getCurMove(mSizeIndex, mCategory, mPattern);
244
    mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves));
243 245
    }
244 246

  
245 247
///////////////////////////////////////////////////////////////////////////////////////////////////
......
254 256
    String patternName = patt.getPatternName(sizeIndex,category,pattern);
255 257
    mText.setText(patternName);
256 258

  
257
    mNumMoves = patt.getNumMoves(sizeIndex,category,pattern);
258
    mCurrMove = patt.getCurMove(sizeIndex,category,pattern);
259
    mNumMoves   = patt.getNumMoves(sizeIndex,category,pattern);
260
    int currMove= patt.getCurMove(sizeIndex,category,pattern);
259 261

  
260
    mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
262
    mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves));
261 263
    }
262 264

  
263 265
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff