public GemStone GetGemstone(int rowIndex, int columnIndex) { ArrayList temp = gemstoneList[rowIndex] as ArrayList; GemStone c = temp[columnIndex] as GemStone; return(c); }
// 宝石交换位置 public void Exchange(GemStone c1, GemStone c2) { audioSource.PlayOneShot(swapClip); setGemStone(c1._row, c1._col, c2); setGemStone(c2._row, c2._col, c1); int tRow; tRow = c1._row; c1._row = c2._row; c2._row = tRow; int tCol; tCol = c1._col; c1._col = c2._col; c2._col = tCol; // 更新位置 //c1.UpdatePosition(c1._row, c1._col); //c2.UpdatePosition(c2._row, c2._col); c1.TweenToPosition(c1._row, c1._col); c2.TweenToPosition(c2._row, c2._col); }
private bool IsRequiredConfirmSell(Reward reward) { if (reward is GemStone) { GemStone gemStone = reward as GemStone; if (gemStone.Rarity != Rune.RARITY.HERO && gemStone.Rarity != Rune.RARITY.LEGENDARY) { Debug.WriteLine($"Ignore confirm sale for Gem/Grindstone {gemStone.Rarity}"); return(false); } } // A+ or such might returns blue 4* rune if (reward is Rune) { Rune rune = reward as Rune; if (rune.Grade.Contains("4")) { Debug.WriteLine($"Ignore confirm sale for {rune.Grade} rune."); return(false); } } return(true); }
public GemStone GetGemStone(int row, int col) { ArrayList temp = gemStones[row] as ArrayList; GemStone c = temp[col] as GemStone; return(c); }
void RemoveMathes() { for (int i = 0; i < mathesGamestone.Count; i++) { GemStone c = mathesGamestone[i] as GemStone; RemoveGemstone(c); } mathesGamestone = new ArrayList(); }
public GemStone AddGemstone(int rowIndex, int columIndex) { GemStone c = Instantiate(gemstone) as GemStone; c.transform.parent = this.transform; c.GetComponent <GemStone> ().RandomCreateGemstoneBg(); c.GetComponent <GemStone> ().UpdatePosition(rowIndex, columIndex); return(c); }
public void RemoveMaches() { for (int i = 0; i < gemStoneMatches.Count; i++) { GemStone c = gemStoneMatches[i] as GemStone; RemoveGemStone(c); } gemStoneMatches.Clear(); StartCoroutine(WaitForCheckMachesAgain()); }
void RemoveMatches() { for (int i = 0; i < matchesGemstoneList.Count; i++) { GemStone c = matchesGemstoneList [i] as GemStone; RemoveGemstone(c); } matchesGemstoneList = new ArrayList(); StartCoroutine(WaitForCheckMatchesAgin()); }
void ExangeAndMathes(GemStone c1, GemStone c2) { Exchange(c1, c2); if (CheckHorizontalMathes() || CheckVerticalMathes()) { RemoveMathes(); } else { Exchange(c2, c1); } }
private GameObject BuildHighLvGemObj(int level, GemMeshType meshType, GemDecalType decalType, int colID) { GameObject gem; if (cfg.isColDependParticle) { gem = GameObject.Instantiate(cfg.PrefabInstances_Particle[(level - 3) * 5 + colID + 2]); } else { gem = GameObject.Instantiate(cfg.PrefabInstances[level - 1]); } string DecalType = decalType == GemDecalType.NULL? "_NoDecal" : "_Decal" + (int)decalType; gem.name = "Gem_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType; GemStone stone = gem.transform.GetChild(0).FindChild("GemObj").gameObject.AddComponent <GemStone>(); stone.meshType = meshType; stone.GetComponent <MeshFilter>().mesh = cfg.GemMeshes[(int)meshType]; stone.level = level; if (stone.Material == null) { //Material tempM = DrawMaterialList(_stone.material, cfg.GetTempMaterialList()); Material tempM = cfg.ChooseTheMat(stone.level, stone.meshType); AssetDatabase.CreateAsset(tempM, cfg.materialsPath + "/Mat_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType + ".mat"); stone.Material = tempM; stone.Material = AssetField <Material>("Material", stone.Material); generatedMats.Add(cfg.materialsPath + "/Mat_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType + ".mat"); } if (stone.meshType == GemMeshType.Oval || stone.meshType == GemMeshType.Sphere) { stone.GemColor = cfg.Colors[colID]; stone.decalType = decalType; if (decalType != GemDecalType.NULL) { stone.DecalColor = cfg.DecalColors[colID]; stone.DecalTex = cfg.AdditiveTexs[(int)decalType]; stone.BumpMap = cfg.AdditiveNormalTexs[(int)decalType]; } else { stone.DecalColor = new Color(0, 0, 0, 0); } stone.MainTex = cfg.BaseTexs[(level - 1) * 5 + colID]; } gem.transform.SetParent(GemsManager.transform); //计算位置: gem.transform.localPosition = GetTheGemPos(level - 1, meshType, decalType, colID); gemMatID++; return(gem); }
void AddMathes(GemStone c) { if (mathesGamestone == null) { mathesGamestone = new ArrayList(); } int index = mathesGamestone.IndexOf(c); if (index == -1) { mathesGamestone.Add(c); } }
public void AddMaches(GemStone c) { if (gemStoneMatches == null) { gemStoneMatches = new ArrayList(); } int index = gemStoneMatches.IndexOf(c); if (index == -1) { gemStoneMatches.Add(c); } }
void AddMatches(GemStone c) { if (matchesGemstoneList == null) { matchesGemstoneList = new ArrayList(); } int index = matchesGemstoneList.IndexOf(c); if (index == -1) { matchesGemstoneList.Add(c); //把相同的宝石放入列表 } }
IEnumerator ExchangeAndMatches(GemStone c1, GemStone c2) { Exchange(c1, c2); yield return(new WaitForSeconds(0.5f)); if (CheckHorizontalMatches() || CheckVerticalMatches()) { RemoveMaches(); } else { Exchange(c1, c2); } }
void RemoveGemstone(GemStone c) { c.Dispose(); audio.PlayOneShot(match3Clip); for (int i = c.rowIndex + 1; i < rowNum; i++) { GemStone temGemstone = GetGemStone(i, c.columIndex); temGemstone.rowIndex--; SetGemStone(temGemstone.rowIndex, temGemstone.columIndex, temGemstone); temGemstone.UpdatePosition(temGemstone.rowIndex, temGemstone.columIndex); } GemStone newGemstone = AddGemstone(rowNum, c.columIndex); newGemstone.rowIndex--; SetGemStone(newGemstone.rowIndex, newGemstone.columIndex, newGemstone); newGemstone.UpdatePosition(newGemstone.rowIndex, newGemstone.columIndex); }
// Use this for initialization void Start() { gemStoneList = new ArrayList(); for (int row = 0; row < rowNum; row++) { ArrayList temp = new ArrayList(); for (int col = 0; col < rowNum; row++) { GemStone c = Instantiate(gemStone) as GemStone; c.transform.parent = this.transform; temp.Add(c); c.GetComponent <GemStone>().UpdatePosition(row, col); } gemStoneList.Add(temp); } }
public AudioClip errorClip; //交换出错的提示音 void Start() { gemstoneList = new ArrayList(); matchesGemstoneList = new ArrayList(); for (int rowIndex = 0; rowIndex < rowNum; rowIndex++) { ArrayList temp = new ArrayList(); for (int columIndex = 0; columIndex < columNum; columIndex++) { GemStone c = AddGemstone(rowIndex, columIndex); temp.Add(c); } gemstoneList.Add(temp); } if (CheckHorizontalMatches() || CheckVerticalMatches()) { RemoveMatches(); } }
public void Exchange(GemStone c1, GemStone c2) { audio.PlayOneShot(swapClip); SetGemStone(c1.rowIndex, c1.columIndex, c2); SetGemStone(c2.rowIndex, c2.columIndex, c1); //huan hang hao int tempRowIndex; tempRowIndex = c1.rowIndex; c1.rowIndex = c2.rowIndex; c2.rowIndex = tempRowIndex; //huan lie hao int tempColumIndex; tempColumIndex = c1.columIndex; c1.columIndex = c2.columIndex; c2.columIndex = tempColumIndex; c1.UpdatePosition(c1.rowIndex, c1.columIndex); c2.UpdatePosition(c2.rowIndex, c2.columIndex); }
public void RemoveGemStone(GemStone c) { Debug.Log("移除"); c.Dispose(); audioSource.PlayOneShot(matchClip); for (int r = c._row + 1; r < rowNum; r++) { GemStone t = GetGemStone(r, c._col); t._row--; setGemStone(t._row, t._col, t); //t.UpdatePosition(t._row, t._col); t.TweenToPosition(t._row, t._col); } GemStone newGemStone = AddGemStone(rowNum, c._col); newGemStone._row--; setGemStone(newGemStone._row, newGemStone._col, newGemStone); //newGemStone.UpdatePosition(newGemStone._row, newGemStone._col); newGemStone.TweenToPosition(newGemStone._row, newGemStone._col); }
public void Exchange(GemStone c1, GemStone c2) { SetGemstone(c1.rowIndex, c1.columnIndex, c2); SetGemstone(c2.rowIndex, c2.columnIndex, c1); //交换c1,c2行号 int tempRowIndex; tempRowIndex = c1.rowIndex; c1.rowIndex = c2.rowIndex; c2.rowIndex = tempRowIndex; int tempColIndex; tempColIndex = c1.columnIndex; c1.columnIndex = c2.columnIndex; c2.columnIndex = tempColIndex; // c1.UpdatePosition(c1.rowIndex, c1.columnIndex); // c2.UpdatePosition(c2.rowIndex, c2.columnIndex); c1.TewwnToPosition(c1.rowIndex, c1.columnIndex); c2.TewwnToPosition(c2.rowIndex, c2.columnIndex); }
void RemoveGemstone(GemStone c) { // 删除 Debug.Log("删除宝石"); c.Dispose(); for (int i = c.rowIndex + 1; i < rowNum; i++) { GemStone temGemstone = GetGemstone(i, c.columnIndex); temGemstone.rowIndex--; SetGemstone(temGemstone.rowIndex, temGemstone.columnIndex, temGemstone); //temGemstone.UpdatePosition(temGemstone.rowIndex, temGemstone.columnIndex); temGemstone.TewwnToPosition(temGemstone.rowIndex, temGemstone.columnIndex); } GemStone newGemstone = AddGemstone(rowNum, c.columnIndex); newGemstone.rowIndex--; SetGemstone(newGemstone.rowIndex, newGemstone.columnIndex, newGemstone); //newGemstone.UpdatePosition(newGemstone.rowIndex, newGemstone.columnIndex); newGemstone.TewwnToPosition(newGemstone.rowIndex, newGemstone.columnIndex); }
public void Select(GemStone c) { if (currentGemStone == null) { currentGemStone = c; currentGemStone.isSelected = true; return; } else { if (Mathf.Abs(currentGemStone.rowIndex - c.rowIndex) + Mathf.Abs(currentGemStone.columIndex - c.columIndex) == 1) { StartCoroutine(ExangeAndMatches(currentGemStone, c)); } else { audio.PlayOneShot(errorClip); } currentGemStone.isSelected = false; currentGemStone = null; } }
// Use this for initialization void Start() { audioSource = GetComponent <AudioSource>(); gemStones = new ArrayList(); for (int row = 0; row < rowNum; row++) { ArrayList temp = new ArrayList(); for (int col = 0; col < colNum; col++) { GemStone c = AddGemStone(row, col); temp.Add(c); } gemStones.Add(temp); } if (CheckHorizontalMatches() || CheckVerticalMatches()) { RemoveMaches(); } }
public void Select(GemStone c) { //Destroy(c.gameObject); if (current == null) { current = c; Debug.Log(string.Format("x:{0},y:{1}", current.rowIndex, current.columnIndex)); //current.IsSelected(true); current.isSelect = true; return; } else { if (Mathf.Abs(current.rowIndex - c.rowIndex) + Mathf.Abs(current.columnIndex - c.columnIndex) == 1) { // Exchange(current, c); ExangeAndMathes(current, c); } //current.IsSelected(false); current.isSelect = false; current = null; } }
public void Select(GemStone c) { //Destroy(c.gameObject); if (curGemStone == null) { curGemStone = c; curGemStone.isSelected = true; } else { if (Mathf.Abs(curGemStone._row - c._row) + Mathf.Abs(curGemStone._col - c._col) == 1) { StartCoroutine(ExchangeAndMatches(curGemStone, c)); } else { audioSource.PlayOneShot(errClip); } curGemStone.isSelected = false; curGemStone = null; } }
private bool ShouldGetGemStone(GemStone gemStone) { return(AcceptedGemStones.Contains(gemStone)); }
public void SetGemstone(int rowIndex, int columnIndex, GemStone c) { ArrayList temp = gemstoneList[rowIndex] as ArrayList; temp[columnIndex] = c; }
public static void Initialize(SouthSeaContext context) { //if (!context.GemStone.Equals(null)) //{ // return; //} var gems = new GemStone[] { new GemStone { TypeStone = "Carnilian Stone" }, new GemStone { TypeStone = "Hematites with Coral" }, new GemStone { TypeStone = "Blue Moon Stone" }, new GemStone { TypeStone = "Amethyst Stone" }, new GemStone { TypeStone = "Cherry Squarts" }, new GemStone { TypeStone = "Hematites with Turkoys" }, new GemStone { TypeStone = "Hematites with Pearl" }, new GemStone { TypeStone = "Tiger Eye" }, new GemStone { TypeStone = "Black Pearl" }, new GemStone { TypeStone = "Turquios" }, new GemStone { TypeStone = "Morano Stones" }, new GemStone { TypeStone = "Rose Squarts" }, new GemStone { TypeStone = "Sun Stones" }, new GemStone { TypeStone = "Red Corals" }, new GemStone { TypeStone = "Whole Light" }, new GemStone { TypeStone = "Black & White Pearls" }, new GemStone { TypeStone = "Puka Shell" }, new GemStone { TypeStone = "Moon Stone" }, new GemStone { TypeStone = "Jade" } }; foreach (var g in gems) { context.GemStone.Add(g); } context.SaveChanges(); }
public void setGemStone(int row, int col, GemStone c) { ArrayList temp = gemStones[row] as ArrayList; temp[col] = c; }