Project

General

Profile

« Previous | Next » 

Revision cf93ea4e

Added by Leszek Koltunski about 1 year ago

Introduce InitAssets. We'll use this later to pass on references to the tablebase file to the TwistyObject (so that it can use this for perfect scrambling)

View differences:

src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
9 9

  
10 10
package org.distorted.objectlib.main;
11 11

  
12
import java.io.InputStream;
13

  
14 12
import android.app.Activity;
15 13
import android.content.SharedPreferences;
16 14

  
......
35 33
  private static final int MAX_SLOW_SCRAMBLE = 50;
36 34

  
37 35
  private final ObjectControl mController;
38
  private InputStream mJsonStream, mMeshStream;
36
  private InitAssets mAsset;
39 37
  private int mOrdinal;
40 38
  private TwistyObject mOldObject, mNewObject;
41 39
  private SharedPreferences mPreferences;
......
102 100

  
103 101
///////////////////////////////////////////////////////////////////////////////////////////////////
104 102

  
105
  private void createObjectNow(int ordinal, int meshState, int iconMode, InputStream jsonStream, InputStream meshStream)
103
  private void createObjectNow(int ordinal, int meshState, int iconMode, InitAssets assets)
106 104
    {
107 105
    long time1 = System.currentTimeMillis();
108 106
    Static3D move = new Static3D(mMoveX,mMoveY,0);
......
110 108
    TwistyObject tmp;
111 109
    boolean error = false;
112 110

  
113
    if( jsonStream==null )
111
    if( assets==null || assets.noJsonStream() )
114 112
      {
115
      tmp = ObjectType.create( ordinal, meshState, iconMode, quat, move, mScale, meshStream);
113
      tmp = ObjectType.create( ordinal, meshState, iconMode, quat, move, mScale, assets);
116 114
      }
117 115
    else
118 116
      {
119
      tmp = new TwistyJson( jsonStream, meshState, iconMode, quat, move, mScale, meshStream);
117
      tmp = new TwistyJson( meshState, iconMode, quat, move, mScale, assets);
120 118
      error = tmp.getError();
121 119
      }
122 120

  
......
275 273
    {
276 274
    mChangeObject = false;
277 275
    blockEverything(BlockController.PLACE_1);
278
    createObjectNow(mOrdinal,mMeshState,mIconMode,mJsonStream,mMeshStream);
276
    createObjectNow(mOrdinal,mMeshState,mIconMode,mAsset);
279 277
    int duration = BaseEffect.Type.SIZECHANGE.getDuration();
280 278
    doEffectNow( BaseEffect.Type.SIZECHANGE, duration );
281 279
    }
......
531 529

  
532 530
///////////////////////////////////////////////////////////////////////////////////////////////////
533 531

  
534
  public void changeObject(int ordinal, int meshState, int iconMode, InputStream jsonStream, InputStream meshStream)
532
  public void changeObject(int ordinal, int meshState, int iconMode, InitAssets asset)
535 533
    {
536 534
    mChangeObject = true;
537 535
    mOrdinal    = ordinal;
538 536
    mMeshState  = meshState;
539 537
    mIconMode   = iconMode;
540
    mJsonStream = jsonStream;
541
    mMeshStream = meshStream;
538
    mAsset      = asset;
542 539
    }
543 540

  
544 541
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff