Friday, April 23, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【JQUERY】 floating menu

Posted: 23 Apr 2021 03:07 AM PDT

$(document).ready(function(){
//Add test dom, generate test data
var arr = [];
for(var i = 0;i<50;i++){
var id ='id'+i;
var $dom = $("<div class='item' id='"+id+"'><div class='head'>"+id+"</div></div>");
$dom.appendTo($("body"));
arr.push(id);
}
//Call method
$.fmenu(arr);
})
$.extend({
fmenu:function(arr){
$(".fbox").remove();
var $fbox = $("<div class='fbox'></div>");
var $head =$("<div class='head'>Floating menu</div>");
var $main = $("<div class='main'></div>");
var $ul = $("<ul class='ul'></ul>")
$ul.appendTo($main);
$head.appendTo($fbox);
$main.appendTo($fbox);
$fbox.appendTo($("body"));
arr.forEach(item=>{
var $li = $("<li><a href='#"+item+"'>"+item+"</a></li>");
$li.appendTo($ul);
})
}
})
view raw script.js hosted with ❤ by GitHub
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
view raw scripts hosted with ❤ by GitHub
*{
margin: 0px;
padding: 0px;
user-select: none;
}
.item{
border: 1px solid lightgray;
margin: 10px;
height: 400px;
border-radius: 5px;
position: relative;
}
.head{
background-color: lightgray;
height: 30px;
display: flex;
justify-content: flex-start;
align-items: center;
text-indent: 10px;
position: absolute;
top: 0px;
width: 100%;
}
.fbox{
position: fixed;
top: 20%;
bottom: 20%;
right: 20px;
width: 150px;
border: 1px solid lightgray;
background-color: white;
border-radius: 5px;
}
.main{
position: absolute;
top: 30px;
width: 100%;
bottom: 0px;
overflow: auto;
}
.main ul{
margin-left: 30px;
}
a{
color: gray;
}
view raw style.css hosted with ❤ by GitHub

【VISUAL VB.NET】Message Boxes

Posted: 22 Apr 2021 08:20 PM PDT

 Imports System

Imports System.Collections.GenericImports System.ComponentModelImports System.DataImports System.DrawingImports System.LinqImports System.TextImports System.Threading.TasksImports System.Windows.Forms' make sure that using System.Diagnostics; is included Imports System.Diagnostics' make sure that using System.Security.Principal; is included Imports System.Security.Principal Public Class Form1 Public Sub New() MyBase.New() InitializeComponent() End Sub #Region "basic function for app" Private Sub lblLink_Click_1(sender As Object, e As EventArgs) Handles lblLink.Click Process.Start("www.vclexamples.com") End Sub Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean If (keyData = Keys.Escape) Then Me.Close() Return True End If Return MyBase.ProcessCmdKey(msg, keyData) End Function#End Region Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click For Each item As StringIn comboBox1.Items If comboBox1.SelectedIndex = 0 Then ' no icon MessageBox.Show(textBox1.Text, "MessageBox", MessageBoxButtons.OK) Exit For End If If comboBox1.SelectedIndex = 1 Then ' info icon ... MessageBox.Show(textBox1.Text, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Information) Exit For End If If comboBox1.SelectedIndex = 2 Then ' question icon MessageBox.Show(textBox1.Text, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Question) Exit For End If If comboBox1.SelectedIndex = 3 Then ' warning icon MessageBox.Show(textBox1.Text, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.Warning) Exit For End If If comboBox1.SelectedIndex = 4 Then ' error icon MessageBox.Show(textBox1.Text, "MessageBox", MessageBoxButtons.OK, MessageBoxIcon.[Error]) Exit For End If Next End Sub Private Sub button2_Click(sender As Object, e As EventArgs) Handles button2.Click Dim d As DialogResult = MessageBox.Show("Choose Yes or No", "MsgBox result", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If d = DialogResult.Yes Then MessageBox.Show("Your choice: YES", "MessageBoxExample", MessageBoxButtons.OK, MessageBoxIcon.Question) End If If d = DialogResult.No Then MessageBox.Show("Your choice: NO", "MessageBoxExample", MessageBoxButtons.OK, MessageBoxIcon.Question) End If End SubEnd Class

【VUEJS】custom multi-level single selection and multiple selection

Posted: 22 Apr 2021 08:12 PM PDT

<div id="app">
<div class="select-box">
<div class="select-title">
<div class="cell-border">
<input type="checkbox" v-model="show">
</div>
</div>
<div class="select-list" v-if="show">
<div class="option" v-for="(item, index) in layouts" :key="index">
<div :class="layouts[item.colKey].column[col.key].checked ? 'option-item-active' : 'option-item'"
:data-key="col.key"
:data-colkey="item.colKey"
:data-name="col.name"
v-for="(col, colIndex) in item.column" :key="colIndex"
@click="getOptionItem(item.colKey, col.key)">
{{col.name}}
</div>
</div>
</div>
</div>
</div>
view raw index.html hosted with ❤ by GitHub
new Vue({
data:{
show:false,
curKey:-1,
colKey:-1,
layouts:[
{
colKey:0,
checked: false,
column:[
{name:"1",key:0,},
{name:"2",key:1,},
{name:"3",key:2,},
{name:"4",key:3,},
{name:"5",key:4,},
{name:"6",key:5,} ]
},
{
colKey:1,
checked: false,
column:[
{name:"1",key:0,},
{name:"2",key:1,},
{name:"3",key:2,},
{name:"4",key:3,},
{name:"5",key:4,},
{name:"6",key:5,} ]
},
{
colKey:2,
checked: false,
column:[
{name:"1",key:0,},
{name:"2",key:1,},
{name:"3",key:2,},
{name:"4",key:3,},
{name:"5",key:4,},
{name:"6",key:5,}]
},
{
colKey:3,
checked: false,
column:[
{name:"1",key:0,},
{name:"2",key:1,},
{name:"3",key:2,},
{name:"4",key:3,},
{name:"5",key:4,},
{name:"6",key:5,}
]
},
{
colKey:4,
checked: false,
column:[
{name:"1",key:0,},
{name:"2",key:1,},
{name:"3",key:2,},
{name:"4",key:3,},
{name:"5",key:4,},
{name:"6",key:5,}
]
}
]
},
methods:{
onChange(){
},
getOptionItem(colItemKey,colKey ){
this.$set(this.layouts[colItemKey].column[colKey], 'checked', !this.layouts[colItemKey].column[colKey].checked);
}
}
}).$mount('#app')
view raw script.js hosted with ❤ by GitHub
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
view raw scripts hosted with ❤ by GitHub
.select-box{
width: 100%;
padding: 20rpx;
box-sizing: border-box;
}
.cell-border {
border-radius: 6rpx;
border: 1px solid #999;
margin-bottom: 10rpx;
}
.select-list{
display: flex;
flex-direction: row;
justify-content: space-around;
width: 100%;
height: 360rpx;
padding: 20rpx;
box-sizing: border-box;
background-color: #fff;
border: 1px solid #eee;
}
.select-list .option{
display: flex;
flex-direction: column;
font-size: 24rpx;
}
.option-item{
width: 80rpx;
height: 100rpx;
background-color: #eee;
text-align: center;
margin-top: 5px;
padding: 2px;
}
.option-item-active{
width: 80rpx;
height: 100rpx;
background-color: #FF6600;
text-align: center;
margin-top: 5px;
padding: 2px;
color:#fff;
}
view raw style.css hosted with ❤ by GitHub

【GAMEMAKER】Party Mechanics Changing Character

Posted: 22 Apr 2021 08:06 PM PDT

 Information about object: obj_player_parent

Sprite: spr_idle_down
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children
obj_player_1
obj_player_2
obj_player_3
Mask:
No Physics Object
Create Event:
execute code:

///set up
enum player_state {
idle,
up,
down,
left,
right
}
dir=player_state.down;
is_moving=false;
image_speed=0.5;
global.move_speed=4;

Step Event:
execute code:

///keypress code
is_moving=false;
if global.selected!=my_id exit;

if (keyboard_check(vk_left))
{
dir=player_state.left;
is_moving=true;
}
else
if (keyboard_check(vk_right))
{
dir=player_state.right;
is_moving=true;
}
else
if (keyboard_check(vk_up))
{
dir=player_state.up;
is_moving=true;
}
else
if (keyboard_check(vk_down))
{
dir=player_state.down;
is_moving=true;
}
else
{
is_moving=false;
}
execute code:

///movement
if is_moving
{
switch (dir)
{
case player_state.up:
if !position_meeting(x,y-global.move_speed,obj_solid_base) y -= global.move_speed;
break;

case player_state.down:
if !position_meeting(x,y+global.move_speed,obj_solid_base) y += global.move_speed;
break;

case player_state.left:
if !position_meeting(x-global.move_speed,y,obj_solid_base) x -= global.move_speed;
break;

case player_state.right:
if !position_meeting(x+global.move_speed,y,obj_solid_base) x += global.move_speed;
break;
}
}
depth=-y;
execute code:


///animation
if is_moving
{
switch (dir)
{
case player_state.up:
sprite_index=spr_walk_up;
break;

case player_state.down:
sprite_index=spr_walk_down;
break;

case player_state.left:
sprite_index=spr_walk_left;
break;

case player_state.right:
sprite_index=spr_walk_right;
break;
}
}
else
{
switch (dir)
{
case player_state.up:
sprite_index=spr_idle_up;
break;

case player_state.down:
sprite_index=spr_idle_down;
break;

case player_state.left:
sprite_index=spr_idle_left;
break;

case player_state.right:
sprite_index=spr_idle_right;
break;
}
}


Information about object: obj_cactus
Sprite: spr_cactus
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_elements_parent
Children:
Mask:

No Physics Object

Information about object: obj_flag
Sprite: spr_flag
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_elements_parent
Children:
Mask:

No Physics Object

Information about object: obj_mushroom
Sprite: spr_mushroom
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_elements_parent
Children:
Mask:

No Physics Object

Information about object: obj_elements_parent
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:

Children
obj_cactus
obj_flag
obj_mushroom
Mask:


No Physics Object

Create Event:
execute code:

instance_create(x,y,obj_solid_base);
depth=-y;

Information about object: obj_solid_base
Sprite: spr_solid_base
Solid: false
Visible: false
Depth:
0
Persistent: false
Parent:

Children
obj_tree
Mask:

No Physics Object

Information about object: obj_selected_control
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

///set up initial selection
global.selected=1;
view_object[0] = obj_player_1;
Step Event:
execute code:

///Key Press For Change Selection
if keyboard_check_released(ord('1'))
{
global.selected=1;
global.move_speed=4;
view_object[0] = obj_player_1;
}
if keyboard_check_released(ord('2'))
{
global.selected=2;
global.move_speed=6;
view_object[0] = obj_player_2;
}
if keyboard_check_released(ord('3'))
{
global.selected=3;
global.move_speed=4;
view_object[0] = obj_player_3;
}
Draw GUI Event:
execute code:

draw_text(50,50,"Keys 1 2 3 To Select - Selected Character="+string(global.selected));

Information about object: obj_tree
Sprite: spr_tree
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_solid_base
Children:
Mask:

No Physics Object

Information about object: obj_player_1
Sprite: spr_walk_down
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_player_parent
Children:
Mask:

No Physics Object

Create Event:
execute code:

my_id=1;
event_inherited();

Information about object: obj_player_2
Sprite: spr_walk_down
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_player_parent
Children:
Mask:

No Physics Object

Create Event:
execute code:

my_id=2;
event_inherited();

Information about object: obj_player_3
Sprite: spr_idle_down
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent: obj_player_parent
Children:
Mask:

No Physics Object

Create Event:
execute code:

my_id=3;
event_inherited();
Collision Event with object obj_tree:
execute code:

///destroy tree
with (other) instance_destroy();

No comments:

Post a Comment