Example #1
0
    //绘制读取的事件
    private void DrawEvent(MapEvent me, DrawCondition dc)
    {
        if (me.isdefault)
        {
            return;
        }
        //开始行
        int a = me.conditionTurn.GetMin();

        if (a == 999)
        {
            return;
        }
        int b = me.conditionTurn.GetMax();

        //Debug.Log(me.name + a + b);
        //算法1:搜寻可以放的下的位置
        for (int i = 0; i < dc.maxRow.Length; i++)
        {
            if (dc.maxRow[i] < a)
            {
                dc.currentColumn = i;
                break;
            }
        }
        dc.maxRow[dc.currentColumn] = a;
        int x = 5 + dc.currentColumn * 105;
        int y = 5 + dc.maxRow[dc.currentColumn] * 55;

        GUI.Button(new Rect(x, y, 100, 50), me.name);
    }
Example #2
0
    public void OnGUI()
    {
        //设定绘制起点
        DrawCondition currentDC = new DrawCondition();

        //事件遍历循环
        GUI.BeginScrollView(new Rect(0, 0, 400, 400), scrollPosition, new Rect(0, 0, 420, 420));
        foreach (KeyValuePair <string, MapEvent> kv in events)
        {
            DrawEvent(kv.Value, currentDC);
            DrawLink(kv.Value, currentDC);
        }
        GUI.EndScrollView();
    }
Example #3
0
        internal static void Draw ( DrawCondition condition )
        {
            TextEffectMgr.Draw();

            foreach (IManagedEffect effect in managedEffects)
            {
                if (condition != null)
                {
                    if (condition( effect ))
                        effect.Draw();
                }
                else
                    effect.Draw();
            }
        }
Example #4
0
        internal static void Draw(DrawCondition condition)
        {
            TextEffectMgr.Draw();

            foreach (IManagedEffect effect in managedEffects)
            {
                if (condition != null)
                {
                    if (condition(effect))
                    {
                        effect.Draw();
                    }
                }
                else
                {
                    effect.Draw();
                }
            }
        }
Example #5
0
 public static void SetCondition ( DrawCondition condi )
 {
     condition = condi;
 }
Example #6
0
 public ConditionalElement(IDrawable element, DrawCondition condition)
 {
     this.element   = element;
     this.condition = condition;
 }
Example #7
0
 private void DrawLink(MapEvent me, DrawCondition dc)
 {
 }
Example #8
0
 public static void SetCondition(DrawCondition condi)
 {
     condition = condi;
 }
        public static PlayerLayer DrawOnLegs(string equip, string texturePath, string femaleEquip = "n", string femaleTexturePath = "n", string name = "LegGlowmask", bool glowmask = true, int useShader = -1, int horizontalFrames = 1, bool pulseFrames = false, float shadow = 0f, DrawCondition drawCondition = null)
        {
            return(new PlayerLayer("QwertysRandomContent", name, PlayerLayer.Legs, delegate(PlayerDrawInfo drawInfo)
            {
                if (drawCondition == null)
                {
                    drawCondition = delegate(Player player) { return player.legs == ModLoader.GetMod("QwertysRandomContent").GetEquipSlot(equip, EquipType.Legs) || (femaleEquip != "n" && player.legs == ModLoader.GetMod("QwertysRandomContent").GetEquipSlot(femaleEquip, EquipType.Legs)); };
                }
                Player drawPlayer = drawInfo.drawPlayer;
                Color color12 = Color.Multiply(drawInfo.lowerArmorColor, 1f - (shadow + (1f - shadow) * drawInfo.shadow));

                if (glowmask)
                {
                    color12 = Color.White;
                }
                Mod mod = ModLoader.GetMod("QwertysRandomContent");
                if (drawCondition(drawPlayer))
                {
                    Texture2D texture = mod.GetTexture(texturePath);
                    if (femaleTexturePath != "n" && !drawPlayer.Male)
                    {
                        texture = mod.GetTexture(femaleTexturePath);
                    }
                    int horizontalFrame = 0;
                    if (horizontalFrames > 1)
                    {
                        int frameTimer = drawPlayer.GetModPlayer <QwertyPlayer>().ArmorFrameCounter % ((pulseFrames ? (2 * horizontalFrames - 2) : horizontalFrames) * 10);
                        horizontalFrame = frameTimer / 10;

                        if (horizontalFrame > horizontalFrames - 1)
                        {
                            horizontalFrame = (horizontalFrames - 1) - (horizontalFrame - (horizontalFrames - 1));
                        }
                    }
                    int drawX = (int)(drawPlayer.position.X - Main.screenPosition.X);
                    int drawY = (int)(drawPlayer.position.Y - Main.screenPosition.Y);
                    Vector2 Position = drawInfo.position;
                    Vector2 origin = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.5f);
                    Vector2 pos = new Vector2((float)((int)(Position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(Position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2));
                    DrawData data = new DrawData(texture, pos, new Rectangle(drawPlayer.legFrame.X + drawPlayer.legFrame.Width * horizontalFrame, drawPlayer.legFrame.Y, drawPlayer.legFrame.Width, drawPlayer.legFrame.Height), color12, 0f, origin, 1f, drawInfo.spriteEffects, 0);
                    if (useShader == -1)
                    {
                        data.shader = drawInfo.legArmorShader;
                    }
                    else
                    {
                        data.shader = drawPlayer.dye[useShader].dye;
                    }
                    Main.playerDrawData.Add(data);
                }
            }));
        }