Exemple #1
0
 public void RuneUpdate(RuneType runeType, int runeCount, bool adding)
 {
     if (runeCount == 0)
     {
         // Remove rune from list
         Blocks.RemoveAll(block => block.IsRune && block.RuneType == runeType);
     }
     else if (runeCount == 1 && adding)
     {
         // Add rune to list
         RuneBlock runeBlock = null;
         if (runeType.type == RuneType.Type.Entity)
         {
             runeBlock = Instantiate(entityBlockPrefab);
         }
         else if (runeType.type == RuneType.Type.Adjective)
         {
             runeBlock = Instantiate(changeTypeBlockPrefab);
         }
         else if (runeType.type == RuneType.Type.Direction)
         {
             runeBlock = Instantiate(moveDirBlockPrefab);
         }
         runeBlock.RuneType               = runeType;
         BlockListRoot.inst.OnUse        += runeBlock.SetUsed;
         BlockListRoot.inst.SetAllUnused += runeBlock.SetUnused;
         runeBlock.transform.SetParent(blockListPanel.transform);
         runeBlock.FindWhereYouBelong();
         Blocks.Add(runeBlock);
         runeBlock.SetRuneCount(runeCount);
     }
     else
     {
         // Update rune count
         var runeBlock = (RuneBlock)Blocks.Find(block => block.IsRune && block.RuneType == runeType);
         if (runeBlock != null)
         {
             runeBlock.SetRuneCount(runeCount);
         }
     }
     //Debug.Log(runeCount);
 }
Exemple #2
0
 public new void OnBeginDrag(PointerEventData eventData)
 {
     if (ContainedScopedBlock is RuneListBlock)
     {
         RuneStock.Inst.DeductRune(runeType);
     }
     if (!IsMovable)
     {
         spawnedBlock                     = Instantiate(blockPrefab, transform.position, Quaternion.identity);
         BlockListRoot.inst.OnUse        += spawnedBlock.SetUsed;
         BlockListRoot.inst.SetAllUnused += spawnedBlock.SetUnused;
         spawnedBlock.IsMovable           = true;
         spawnedBlock.RuneType            = RuneType;
         spawnedBlock.BaseOnPointerDown(eventData);
         spawnedBlock.BaseOnBeginDrag(eventData);
     }
     else
     {
         BaseOnBeginDrag(eventData);
     }
 }