Пример #1
0
        public override UserPrompt CountingPromptGenerator(User user, int counter)
        {
            if (counter % 3 == 0)
            {
                UsersToRandomizedBodyPartTypes[user] = ThreePartPeopleConstants.BodyPartTypesList.OrderBy(_ => Rand.Next()).ToList();
            }
            BodyPartType bodyPartType = UsersToRandomizedBodyPartTypes[user][counter % 3];

            return(new UserPrompt()
            {
                UserPromptId = UserPromptId.BattleReady_BodyPartDrawing,
                Title = Invariant($"Time to draw! Drawing {counter + 1} of {NumExpectedPerUser} expected"),
                Description = "Draw the prompt below. Keep in mind you are only drawing part of the person!",
                SubPrompts = new SubPrompt[]
                {
                    new SubPrompt
                    {
                        Prompt = Invariant($"Draw any \"{bodyPartType.ToString()}\""),
                        Drawing = new DrawingPromptMetadata()
                        {
                            /* WidthInPx = ThreePartPeopleConstants.Widths[bodyPartType],   these are now set through gallerytype on the front end
                             * HeightInPx = ThreePartPeopleConstants.Heights[bodyPartType],
                             * CanvasBackground = ThreePartPeopleConstants.Backgrounds[bodyPartType], */
                            DrawingType = bodyPartType.GetDrawingType(),
                        },
                    },
                },
                SubmitButton = true
            });
        }
Пример #2
0
 public override void OnEditorRefresh()
 {
     try {
         worlditem.Props.Local.Subcategory = BodyPart.ToString();
     } catch (Exception e) {
         Debug.LogError(e.ToString());
     }
 }
Пример #3
0
 public override void SetInventoryStackNumber()
 {
     if (HasStack && mStack.HasTopItem)
     {
         StackNumberLabel.text = string.Empty;
     }
     else
     {
         StackNumberLabel.text  = BodyPart.ToString();
         StackNumberLabel.color = Colors.Darken(Colors.Get.WorldMapLabelColor);
     }
 }
Пример #4
0
    public void equip(BodyPartType bodyPart, int id, bool changeId = true)
    {
        if (bodyPart == BodyPartType.WEAPON)
        {
            WeaponType weapType = rm.getWeaponType(id);
            charModel.equip.weaponID = id;

            // if this weapon is two-handed and a subweapon is equipped, unequip the subweapon first
            if (!Utils.isOneHanded(weapType) && charModel.equip.shieldID > 0)
            {
                equip(BodyPartType.SUBWEAPON, 0);
            }

            // Change skeleton if weapon type is different
            if (weapType != charModel.weapon)
            {
                charModel.weapon = weapType;
                LoadPlayerSkeleton(charModel);
                return;
            }
        }

        // If equipping subweapon and a two-hand weapon is equipped, first unequip the 2-hand
        if ((bodyPart == BodyPartType.SUBWEAPON) && id > 0 && !Utils.isOneHanded(charModel.weapon))
        {
            equip(BodyPartType.WEAPON, 0);
        }


        // If equipping cap, first make sure the hair is changed to the right type
        if (bodyPart == BodyPartType.CAP)
        {
            String hairOffsetStr = rm.stb_cap_list.Cells[id][34];
            int    hairOffset    = (hairOffsetStr == "") ? 0 : int.Parse(hairOffsetStr);
            equip(BodyPartType.HAIR, charModel.equip.hairID - (charModel.equip.hairID) % 5 + hairOffset, false);
        }

        if (changeId)
        {
            charModel.changeID(bodyPart, id);
        }

        List <Transform> partTransforms = Utils.findChildren(player, bodyPart.ToString());

        foreach (Transform partTransform in partTransforms)
        {
            Utils.Destroy(partTransform.gameObject);
        }


        LoadObject(bodyPart, id);
    }
Пример #5
0
 private static string InTheZone(BodyPartType hitZone)
 {
     return(hitZone == BodyPartType.None ? "" : $" in the {hitZone.ToString().ToLower().Replace("_", " ")}");
 }
Пример #6
0
        public static string GetName(this BodyPartType prop)
        {
            var description = EnumHelper.GetAttributeOfType <DisplayAttribute>(prop);

            return(description?.Name ?? prop.ToString() ?? "");
        }
Пример #7
0
    private Bounds LoadPart(BodyPartType bodyPart, ZSC.DummyType dummy, string zmsPath, string texPath)
    {
        zmsPath = Utils.FixPath(zmsPath);
        texPath = Utils.FixPath(texPath).Replace("dds", "png");

        // Cached load of ZMS and texture
        ResourceManager rm  = ResourceManager.Instance;
        ZMS             zms = (ZMS)rm.cachedLoad(zmsPath);
        Texture2D       tex = (Texture2D)rm.cachedLoad(texPath);

        // Create material
        string shader = "VertexLit";

        if (bodyPart == BodyPartType.BACK)
        {
            shader = "Transparent/Cutout/VertexLit";
        }

        Material mat = new Material(Shader.Find(shader));

        mat.SetTexture("_MainTex", tex);
        mat.SetColor("_Emission", new Color(0.15f, 0.15f, 0.15f));

        GameObject modelObject = new GameObject();

        switch (bodyPart)
        {
        case BodyPartType.FACE:
        case BodyPartType.HAIR:
            modelObject.transform.parent = Utils.findChild(skeleton, "b1_head");
            break;

        case BodyPartType.CAP:      // TODO: figure out how to fix issue of hair coming out of cap
            modelObject.transform.parent = Utils.findChild(skeleton, "p_06");
            break;

        case BodyPartType.BACK:
            modelObject.transform.parent = Utils.findChild(skeleton, "p_03");
            break;

        case BodyPartType.WEAPON:
            if (charModel.weapon == WeaponType.DSW || charModel.weapon == WeaponType.KATAR)
            {
                modelObject.transform.parent = Utils.findChild(skeleton, dummy == ZSC.DummyType.RightHand? "p_00" : "p_01");
            }
            else
            {
                modelObject.transform.parent = Utils.findChild(skeleton, "p_00");
            }
            break;

        case BodyPartType.SUBWEAPON:
            modelObject.transform.parent = Utils.findChild(skeleton, "p_02");
            break;

        default:
            modelObject.transform.parent = skeleton.transform.parent.transform;
            break;
        }

        modelObject.transform.localPosition = Vector3.zero;
        modelObject.transform.localRotation = Quaternion.identity;
        modelObject.transform.localScale    = Vector3.one;
        modelObject.name = bodyPart.ToString();
        Mesh mesh = zms.getMesh();

        if (zms.support.bones)
        {
            SkinnedMeshRenderer renderer = modelObject.AddComponent <SkinnedMeshRenderer>();

            mesh.bindposes      = bindPoses.bindPoses;
            renderer.sharedMesh = mesh;
            renderer.material   = mat;
            renderer.bones      = bindPoses.boneTransforms;
        }
        else
        {
            modelObject.AddComponent <MeshFilter>().mesh = mesh;
            MeshRenderer renderer = modelObject.AddComponent <MeshRenderer>();
            renderer.material = mat;
        }

        return(mesh.bounds);
    }
Пример #8
0
    public void equip(BodyPartType bodyPart, int id, bool changeId = true)
    {
        if (bodyPart == BodyPartType.WEAPON) {
            WeaponType weapType = rm.getWeaponType (id);
            charModel.equip.weaponID = id;

            // if this weapon is two-handed and a subweapon is equipped, unequip the subweapon first
            if ( !Utils.isOneHanded(weapType) && charModel.equip.shieldID > 0)
                equip(BodyPartType.SUBWEAPON, 0);

            // Change skeleton if weapon type is different
            if (weapType != charModel.weapon) {
                charModel.weapon = weapType;
                LoadPlayerSkeleton ( charModel );
                return;
            }
        }

        // If equipping subweapon and a two-hand weapon is equipped, first unequip the 2-hand
        if (( bodyPart == BodyPartType.SUBWEAPON) && id > 0 && !Utils.isOneHanded(charModel.weapon))
                equip(BodyPartType.WEAPON, 0);

        // If equipping cap, first make sure the hair is changed to the right type
        if(bodyPart == BodyPartType.CAP)
        {
            String hairOffsetStr = rm.stb_cap_list.Cells[id][34];
            int hairOffset = (hairOffsetStr == "") ? 0 : int.Parse(hairOffsetStr);
            equip(BodyPartType.HAIR, charModel.equip.hairID - (charModel.equip.hairID)%5 + hairOffset, false);
        }

        if( changeId)
            charModel.changeID(bodyPart, id);

        List<Transform> partTransforms = Utils.findChildren (player, bodyPart.ToString());

        foreach (Transform partTransform in partTransforms)
            Utils.Destroy(partTransform.gameObject);

        LoadObject(bodyPart, id);
    }
Пример #9
0
    private Bounds LoadPart(BodyPartType bodyPart, ZSC.DummyType dummy, string zmsPath, string texPath)
    {
        zmsPath = Utils.FixPath(zmsPath);
        texPath = Utils.FixPath (texPath).Replace ("dds", "png");

        // Cached load of ZMS and texture
        ResourceManager rm = ResourceManager.Instance;
        ZMS zms = (ZMS)rm.cachedLoad(zmsPath);
        Texture2D tex = (Texture2D)rm.cachedLoad(texPath);

        // Create material
        string shader = "VertexLit";
        if (bodyPart == BodyPartType.BACK)
            shader = "Transparent/Cutout/VertexLit";

        Material mat = new Material(Shader.Find(shader));

        mat.SetTexture("_MainTex", tex);
        mat.SetColor("_Emission", new Color(0.15f, 0.15f, 0.15f));

        GameObject modelObject = new GameObject();

        switch ( bodyPart )
        {
            case BodyPartType.FACE:
            case BodyPartType.HAIR:
                modelObject.transform.parent = Utils.findChild(skeleton, "b1_head");
                break;
            case BodyPartType.CAP:  // TODO: figure out how to fix issue of hair coming out of cap
                modelObject.transform.parent = Utils.findChild(skeleton, "p_06");
                break;
            case BodyPartType.BACK:
                modelObject.transform.parent = Utils.findChild(skeleton, "p_03");
                break;
            case BodyPartType.WEAPON:
                if(charModel.weapon == WeaponType.DSW || charModel.weapon == WeaponType.KATAR )
                    modelObject.transform.parent = Utils.findChild(skeleton, dummy == ZSC.DummyType.RightHand? "p_00" : "p_01");
                else
                    modelObject.transform.parent = Utils.findChild(skeleton, "p_00");
                break;
            case BodyPartType.SUBWEAPON:
                modelObject.transform.parent = Utils.findChild(skeleton, "p_02");
                break;
            default:
                modelObject.transform.parent = skeleton.transform.parent.transform;
                break;
        }

        modelObject.transform.localPosition = Vector3.zero;
        modelObject.transform.localRotation = Quaternion.identity;
        modelObject.transform.localScale = Vector3.one;
        modelObject.name = bodyPart.ToString ();
        Mesh mesh = zms.getMesh();
        if (zms.support.bones)
        {
            SkinnedMeshRenderer renderer = modelObject.AddComponent<SkinnedMeshRenderer>();

            mesh.bindposes = bindPoses.bindPoses;
            renderer.sharedMesh = mesh;
            renderer.material = mat;
            renderer.bones = bindPoses.boneTransforms;
        }
        else
        {
            modelObject.AddComponent<MeshFilter>().mesh = mesh;
            MeshRenderer renderer = modelObject.AddComponent<MeshRenderer>();
            renderer.material = mat;
        }

        return mesh.bounds;
    }