Ejemplo n.º 1
0
        public Anna(ContentManager content, Vector2 initialPosition, Size2 size)
            : base(initialPosition, size)
        {
            float frameDuration = 1.0f / 4.0f;

            var animatedSprite = AnimationLoader.LoadAnimatedSprite(content,
                                                                    "animations/NPC_25",
                                                                    "animations/annaMap",
                                                                    "anna",
                                                                    frameDuration,
                                                                    true);


            _sprite = animatedSprite;
            _sprite.Play("walk_right");

            X = initialPosition.X;
            Y = initialPosition.Y;

            if (HarvestMoon.Instance.ScreenManager.ActiveScreen is Screens.Library)
            {
                BoundingBoxEnabled = false;
            }
            else
            {
                BoundingBoxEnabled = true;
            }
        }
Ejemplo n.º 2
0
        public Crop(ContentManager content, Vector2 initialPosition, string cropType, int maturity)
        {
            Content = content;

            var cropsA = AnimationLoader.LoadAnimatedSprite(content,
                                                            "animations/cropsA",
                                                            "animations/cropsAMap",
                                                            "cropsA",
                                                            1.0f / 7.5f,
                                                            false);


            var cropsB = AnimationLoader.LoadAnimatedSprite(content,
                                                            "animations/cropsB",
                                                            "animations/cropsBMap",
                                                            "cropsB",
                                                            1.0f / 7.5f,
                                                            false);


            _sprite = cropsB;

            _cropsA = cropsA;
            _cropsB = cropsB;

            _sprite.Play("soil_normal");

            X = initialPosition.X;
            Y = initialPosition.Y;

            CropType = cropType;
            HaveMaturity(maturity);

            _sprite.Play(CropType + "_" + Maturity);
        }
Ejemplo n.º 3
0
        public IEnumerator OnSingleImageCached(byte[] bytes, string id, bool isAnimated, Action <EnhancedImageInfo> Finally = null, int forcedHeight = -1)
        {
            if (bytes.Length == 0)
            {
                Finally(null);
                yield break;
            }

            Sprite sprite = null;
            int    spriteWidth = 0, spriteHeight = 0;
            AnimationControllerData animControllerData = null;

            if (isAnimated)
            {
                AnimationLoader.Process(AnimationType.GIF, bytes, (tex, atlas, delays, width, height) =>
                {
                    animControllerData = AnimationController.instance.Register(id, tex, atlas, delays);
                    sprite             = animControllerData.sprite;
                    spriteWidth        = width;
                    spriteHeight       = height;
                });
                yield return(new WaitUntil(() => animControllerData != null));
            }
            else
            {
                try
                {
                    sprite       = GraphicUtils.LoadSpriteRaw(bytes);
                    spriteWidth  = sprite.texture.width;
                    spriteHeight = sprite.texture.height;
                }
                catch (Exception ex)
                {
                    Logger.log.Error(ex);
                    sprite = null;
                }
            }
            EnhancedImageInfo ret = null;

            if (sprite != null)
            {
                if (forcedHeight != -1)
                {
                    SetImageHeight(ref spriteWidth, ref spriteHeight, forcedHeight);
                }
                ret = new EnhancedImageInfo()
                {
                    ImageId            = id,
                    Sprite             = sprite,
                    Width              = spriteWidth,
                    Height             = spriteHeight,
                    AnimControllerData = animControllerData
                };
                _cachedImageInfo[id] = ret;
            }
            Finally?.Invoke(ret);
        }
Ejemplo n.º 4
0
 public void ReleaseSingleExtraAni(string clipName)
 {
     OwnerAni.DestroyClip(clipName);
     if (!string.IsNullOrEmpty(clipName))
     {
         AnimationLoader.ReleaseSingleAnimation(clipName);
         m_ExtraclipName.Remove(clipName);
     }
 }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     BlockComponent = GetComponent <DataBlockComponent>();
     GooberPrefab   = Resources.Load("Objects/Goober");
     Animations     = GetComponent <AnimationLoader>();
     if (Animations == null)
     {
         Animations = GetComponentInChildren <AnimationLoader>();
     }
 }
Ejemplo n.º 6
0
        public override IEnumerator LoadSceneAnimation()
        {
            AnimationLoader.ClearStageSceneAnimation();

            IEnumerator itor = AnimationLoader.LoadRoomSceneAnimation();

            while (itor.MoveNext())
            {
                yield return(null);
            }
        }
Ejemplo n.º 7
0
    IEnumerator LoadRole()
    {
        //yield return UICoroutine.uiCoroutine.StartCoroutine(ClientResourcesMgr.LoadClientResource());

        //yield return UICoroutine.uiCoroutine.StartCoroutine(UIMgr.ShowUIAsync(UIFlag.ui_activity, null));

        yield return(UICoroutine.uiCoroutine.StartCoroutine(AnimationLoader.LoadRoleCreateAnimation()));

        yield return(UICoroutine.uiCoroutine.StartCoroutine(PreparePlayerModel()));

        SwitchingControl.HideSwitching();
        ///cStageManager.Instance.ChangeStage(cBaseStage.eSTAGE.eStage_Game);
    }
Ejemplo n.º 8
0
    private void RemoveTransformWalkAni()
    {
        if (!string.IsNullOrEmpty(m_strCurTransformAni))
        {
            if (m_OwnerAni != null)
            {
                m_OwnerAni.DestroyClip(AniMoveState.Stand.ToString());
            }

            StopCoroutine("AddTransformAni");
            AnimationLoader.ReleaseSingleAnimation(m_strCurTransformAni);

            m_strCurTransformAni = null;
        }
    }
Ejemplo n.º 9
0
    private void AddStandAni(List <string> aniList)
    {
        mStandAniList.Clear();
        AnimationClip clip     = null;
        string        clipName = null;

        for (int i = 0; i < aniList.Count; ++i)
        {
            clipName = aniList[i];
            clip     = AnimationLoader.GetAnimationClip(clipName);
            if (clip != null)
            {
                mStandAniList.Add(clipName);
                OwnerAni.AddClip(clip, clipName, WrapMode.Once, 2, 0f);
            }
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Add By hanyingjun
    /// Date:2017.1.20
    /// Des:添加单个动画,到额外的动画列表中
    /// </summary>
    /// <param name="clipName"></param>
    /// <returns></returns>
    public IEnumerator AddSingleAnimation(string clipName, WrapMode wrapMode, int layer)
    {
        IEnumerator itor = null;

        if (!string.IsNullOrEmpty(clipName))
        {
            if (!m_ExtraclipName.Contains(clipName))
            {
                m_ExtraclipName.Add(clipName);
                itor = AnimationLoader.LoadSingleAnimation(clipName);
                while (itor.MoveNext())
                {
                    yield return(null);
                }

                OwnerAni.AddClip(AnimationLoader.GetAnimationClip(clipName), clipName, wrapMode, layer);
            }
        }
    }
Ejemplo n.º 11
0
        public Ground(int groundHeight, int screenWidth, int screenHeight) : base()
        {
            this.groundHeight = groundHeight;
            this.screenWidth  = screenWidth;
            this.screenHeight = screenHeight;
            textureTop        = AnimationLoader.pngToTexture("Environment/grassFlat.jpg");
            textureFeature    = AnimationLoader.pngToTexture("Environment/grassUp.png");
            textureUnder      = AnimationLoader.pngToTexture("Environment/sand.png");
            tree      = AnimationLoader.pngToTexture("Environment/Tree1.png");
            tree2     = AnimationLoader.pngToTexture("Environment/Tree3.png");
            sliceSize = screenWidth / pieces;
            Random r = new Random();

            for (int i = 0; i < numTrees; i++)
            {
                treeArray[i].X = r.Next(0, screenWidth);
                treeArray[i].Y = r.Next(treeMin, treeMax);
                treeType[i]    = r.Next(0, 2);
            }
        }
Ejemplo n.º 12
0
        public Mouse(ContentManager content, Vector2 initialPosition, Size2 size)
            : base(initialPosition, size)
        {
            float frameDuration = 1.0f / 7.5f;

            _sprite = AnimationLoader.LoadAnimatedSprite(content,
                                                         "animations/mouse",
                                                         "animations/mouseMap",
                                                         "mouse",
                                                         frameDuration,
                                                         true);

            _sprite.Play("walk_left");

            X = initialPosition.X;
            Y = initialPosition.Y;

            BoundingBoxEnabled = true;
            Interacts          = false;
        }
Ejemplo n.º 13
0
        public Monica(ContentManager content, Vector2 initialPosition, Size2 size)
            : base(initialPosition, size)
        {
            float frameDuration = 1.0f / 4.0f;

            var animatedSprite = AnimationLoader.LoadAnimatedSprite(content,
                                                                    "animations/NPC_19",
                                                                    "animations/monicaMap",
                                                                    "monica",
                                                                    frameDuration,
                                                                    true);


            _sprite = animatedSprite;
            _sprite.Play("walk_down");

            X = initialPosition.X;
            Y = initialPosition.Y;

            BoundingBoxEnabled = true;
        }
Ejemplo n.º 14
0
    public void Update(uint id, AssemblerInfo info)
    {
        if (info == null) return;

        //Debug.Log(".Update  " + id + " " + JsonWriter.Serialize(info));

        info.m_ID = id;

        if (!string.IsNullOrEmpty(info.m_Character)
            && !s_CharacterLoaders.ContainsKey(info.m_Character))
        {
            CharacterLoader cl = new CharacterLoader(info.m_Character + "_" + AssemblerConstant.CHARACTER_BASE_NAME + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterLoaders.Add(info.m_Character, cl);
        }

        if (!string.IsNullOrEmpty(info.m_HeadElement)
            && !s_CharacterElementLoaders.ContainsKey(info.m_HeadElement))
        {
            CharacterElementLoader cel = new CharacterElementLoader(info.m_HeadElement, info.m_HeadElement + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterElementLoaders.Add(info.m_HeadElement, cel);
        }

        if (!string.IsNullOrEmpty(info.m_BodyElement)
            && !s_CharacterElementLoaders.ContainsKey(info.m_BodyElement))
        {
            CharacterElementLoader cel = new CharacterElementLoader(info.m_BodyElement, info.m_BodyElement + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterElementLoaders.Add(info.m_BodyElement, cel);
        }

        if (!string.IsNullOrEmpty(info.m_FootElement)
            && !s_CharacterElementLoaders.ContainsKey(info.m_FootElement))
        {
            CharacterElementLoader cel = new CharacterElementLoader(info.m_FootElement, info.m_FootElement + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterElementLoaders.Add(info.m_FootElement, cel);
        }

        if (!string.IsNullOrEmpty(info.m_Character)
            && !s_AnimationAssemblers.ContainsKey(info.m_Character + AssemblerConstant.ANIMATION_SUFFIX))
        {
            AnimationLoader aa = new AnimationLoader(info.m_Character + AssemblerConstant.ANIMATION_SUFFIX + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_AnimationAssemblers.Add(info.m_Character + AssemblerConstant.ANIMATION_SUFFIX, aa);
        }

        if (!string.IsNullOrEmpty(info.m_WeaponR)
            && !s_ModelLoaders.ContainsKey(info.m_WeaponR))
        {
            ModelLoader ml = new ModelLoader(info.m_WeaponR + "_" + AssemblerConstant.CHARACTER_BASE_NAME + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_ModelLoaders.Add(info.m_WeaponR, ml);
        }

        if (!string.IsNullOrEmpty(info.m_WeaponL)
            && !s_ModelLoaders.ContainsKey(info.m_WeaponL))
        {
            ModelLoader ml = new ModelLoader(info.m_WeaponL + "_" + AssemblerConstant.CHARACTER_BASE_NAME + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_ModelLoaders.Add(info.m_WeaponL, ml);
        }

        //if (!string.IsNullOrEmpty(info.m_Wing)
        //    && !s_CharacterLoaders.ContainsKey(info.m_Wing))
        //{

        //}

        if (!string.IsNullOrEmpty(info.m_WingElement)
            && !s_CharacterElementLoaders.ContainsKey(info.m_WingElement))
        {

            CharacterLoader ml = new CharacterLoader(info.m_WingElement + "_" + AssemblerConstant.CHARACTER_BASE_NAME + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterLoaders.Add(info.m_WingElement, ml);

            AnimationLoader aa = new AnimationLoader(info.m_WingElement + AssemblerConstant.ANIMATION_SUFFIX + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_AnimationAssemblers.Add(info.m_WingElement + AssemblerConstant.ANIMATION_SUFFIX, aa);

            CharacterElementLoader cel = new CharacterElementLoader(info.m_WingElement, info.m_WingElement + AssemblerConstant.ASSETBUNDLE_SUFFIX);
            s_CharacterElementLoaders.Add(info.m_WingElement, cel);
        }

        //if (!string.IsNullOrEmpty(info.m_Wing)
        //    && !s_AnimationAssemblers.ContainsKey(info.m_Wing + AssemblerConstant.ANIMATION_SUFFIX))
        //{

        //}

        info.m_IsDone = false;
        if (m_Assemblers.ContainsKey(id))
        {
            m_Assemblers[id] = new AssemblerInfo(ref info);
            //m_Assemblers.Remove(id);
        }
        else
        {
            m_Assemblers.Add(id, info);
        }

        if (!mCorout_isRunning)
        {
            mCorout_isRunning = true;
            StartCoroutine(LoadCoroutine());
        }

        //Debug.Log("Create assemble: " + DecToHex(id) + " status: " + info.m_IsDone);

        return;
    }