コード例 #1
0
 private void OnActorPreloaded(string actorName, GameObject actorObject, object callbackData)
 {
     this.m_actorsPreloaded++;
     if (actorObject == null)
     {
         Debug.LogWarning(string.Format("CollectionActorPool.OnActorPreloaded() - FAILED to load actor \"{0}\"", actorName));
     }
     else
     {
         Actor component = actorObject.GetComponent <Actor>();
         if (component == null)
         {
             Debug.LogWarning(string.Format("CollectionActorPool.OnActorPreloaded() - ERROR actor \"{0}\" has no Actor component", actorName));
         }
         else
         {
             actorObject.transform.position = new Vector3(-9999f, -9999f, 9999f);
             component.TurnOffCollider();
             ActorLoadCallbackData data = (ActorLoadCallbackData)callbackData;
             component.SetCardFlair(data.m_cardFlair);
             this.m_actorKeyMap.Add(component, data.m_key);
             if (!data.m_owned)
             {
                 string cardId = data.m_entityDef.GetCardId();
                 this.MissingCardDisplay(component, cardId, data.m_cardFlair.Premium);
             }
             this.ReleaseActor(component);
         }
     }
 }
コード例 #2
0
 private void OnActorLoaded(string actorName, GameObject actorObject, object callbackData)
 {
     if (actorObject == null)
     {
         Debug.LogWarning(string.Format("CollectionActorPool.OnActorLoaded() - FAILED to load actor \"{0}\"", actorName));
     }
     else
     {
         Actor component = actorObject.GetComponent <Actor>();
         if (component == null)
         {
             Debug.LogWarning(string.Format("CollectionActorPool.OnActorLoaded() - ERROR actor \"{0}\" has no Actor component", actorName));
         }
         else
         {
             component.TurnOffCollider();
             ActorLoadCallbackData data = (ActorLoadCallbackData)callbackData;
             component.SetEntityDef(data.m_entityDef);
             component.SetCardFlair(data.m_cardFlair);
             if (!data.m_owned)
             {
                 string cardId = data.m_entityDef.GetCardId();
                 this.MissingCardDisplay(component, cardId, data.m_cardFlair.Premium);
             }
             data.m_callback(component, data.m_callbackData);
         }
     }
 }
コード例 #3
0
    public bool AcquireActor(EntityDef entityDef, CardFlair flair, AcquireActorCallback callback, object callbackData)
    {
        if (entityDef == null)
        {
            Debug.LogError("Cannot acquire actor; entityDef is null!");
            return(false);
        }
        bool     owned = CollectionManager.Get().IsCardInCollection(entityDef.GetCardId(), flair);
        ActorKey key   = this.MakeActorKey(entityDef, flair, owned);
        string   heroSkinOrHandActor = ActorNames.GetHeroSkinOrHandActor(entityDef.GetCardType(), flair.Premium);
        ActorLoadCallbackData data   = new ActorLoadCallbackData {
            m_key          = key,
            m_owned        = owned,
            m_entityDef    = entityDef,
            m_cardFlair    = flair,
            m_callback     = callback,
            m_callbackData = callbackData
        };

        AssetLoader.Get().LoadActor(heroSkinOrHandActor, new AssetLoader.GameObjectCallback(this.OnActorLoaded), data, false);
        return(true);
    }